Why to use Git/Advantages of using Git

Git is a version control system for tracking changes in computer files and coordinating work on those files among multiple people. Git can be used to maintain histories of your work, collaborate with other team members, go to any historical state of your work and lot more. In this article, we will try to figure out following:   1. What are the advantages of using git. 2. Why Git is so famous around the community. 3. What all people get benefit when git used as development VCS.   Let’s first try to find out what are the advantages of Git …

Continue Reading

How do I delete a Git branch both locally and remotely

When you are working with version control system with workflow that require new branch for each new feature, you will often have to clean non required branch mess quite in a while. When we talk about, how to delete a Git branch. Delete branch locally: You can remove local branch using following command:

The -d option is an alias for –delete, which only deletes the branch if it has already been fully merged in its upstream branch. You could also use -D, which is an alias for –delete –force, which deletes the branch “irrespective of its merged status.” Delete Remote Branch: You can also delete …

Continue Reading

Given a talk about Advanced Git at Directi

Git is a awesome Version Control System for tracking changes in files and coordinating work  on those file with multiple people. Most of  developer use git every day to save work and collaborate with other team member. For open source projects, i use Github while for private Repository Gitlab because it’s free. Github also have private Repositories but they are not free, you have to pay monthly charges for it. But yes in Github monthly subscription, they also provide lot of additional features. This article is about my presentation talk about Advanced Git at Directi,   Presntation Link : https://www.slideshare.net/odinagupta/advanted-git   …

Continue Reading

How to move uncommitted changes between branches in Git

While working with feature branch workflow, it’s may happen sometime that you made changes in main branch but you wanted to develop that feature in separate branch. You haven’t committed the changes yet and suddenly you realized that these changes should be on new branch or that particular branch. Git provide a feature which can save your day. We call git stashing,  it allows you to move uncommitted changes between branches. This feature is build to save your uncommitted changes work before making a urgent quick fix in the project. Best thing about this feature is that it save changes …

Continue Reading

How to rename a git branch

Git branching is very essential feature when you are working in a team and different team member are handling different features. There are some instances when you might have to rename branch  like   When got a better branch name that you already assigned…..ha ha!!!. Your manager wants that feature to reinvent with new strategy. Some other reasons of yours. If you want to rename a branch while you are on any other branch.

If you want to rename the current branch, you are on.

In case of any query, comment below.   Also Read: How do I …

Continue Reading

Ignoring Files and Folders using GitIgnore

When you are using Git for CVS,  you will never want to push unnecessary file to your remote. These file maybe your editor configuration files, dist directory, node modules etc. For this purpose, git check a .gitignore rules before pushing changes  to server. In short, you can define the rules for Ignoring Files and Folders which you want to exclude from git. .gitignore Specifies intentionally untracked files to ignore.   Each line in gitignore file specifies a pattern. Files already tracked are not affected by gitignore. You can also add comment in gitignore by putting # at start of line. …

Continue Reading

How to change a commit/rewrite history

There are lot of cases when you have to rewrite history. Let’s us suppose, you are developing a feature and you have made 10 commits till the feature completion. but when you are merging that feature to the project, you wanna show only one commit msg for entire feature. In such a cases, we wanna rewrite existing commit history. Git allows us to rewrite history if required. While using git, you might get stuck in one of following situation. Fix the typo in commit you have made. Add some more changes in last commit. Fix the typo in commit you have …

Continue Reading

Git Tagging in Depth

Git tagging is actually applying marker at a specific point during the software development phase. This can be done either to go back at that particular state of your code or to mark different states of the project development which you can refer later on. In this Git tagging article, we will go through the following basic operations: Types of tag Creating a tag in a git repository List git tags How to tag an older commit Push a tag to a remote repository Checkout a new branch from a particular git tag Rename an existing tag Remove or delete a git tag …

Continue Reading

How to Install Git on Mac

Git is a version control system for tracking changes in computer files and coordinating work on those files among multiple people. You can install git on mac OS in several ways. You can install it using Package Manager like Homebrew, MacPorts or by downloading a git installer package. We will install git using Homebrew package manager. If you don’t have homebrew already installed, check Homebrew website for installation instructions.   Installing Git using Homebrew:   First of all, update your brew.

2.  After successfully updating homebrew, now you can install git.

3. You can check installed git version …

Continue Reading

How to remove untracked files

Untracked changes are changes which are not being added to staging area yet. In git, you add changes to staging area using git add <filename/directoryname/ .> Sometime you change some file or add some files/directories but later you don’t wanna include them in the project. So you wanna remove untracked changes. You can do that in below simple steps: First of all, you check all untracked changes.

Above command will list all untracked changes. Now you can delete it using following commands.   Just note that this step will delete your files.

To remove directories, run git clean -f …

Continue Reading