Version Control – What is the benefit of git’s two-stage commit?
I’m using BitBucket over
GitHub because it provides
free private repositories. Let’s start discussion basic Git workflow.
The basic Git workflow goes something like this:
- You modify files in your working directory.
- You stage the files, adding snapshots of them to your staging area.
- You do a commit, which takes the files as they are in the staging area and stores that snapshot permanently to your Git directory.
stage a file is simply to prepare it finely for a commit. Git, with its index allows you to commit only certain parts of the changes you’ve done since the last commit.
Say you’re working on two features – one is finished, and one still needs some work done. You’d like to make a commit and go home but wouldn’t like to commit the parts of the second feature, which is not done yet. You stage the parts you know belong to the first feature, and
Now your commit is your project with the first feature done, while the second is still in work-in-progress in your working directory.
Some more details:
This tutorial will work also if you have one of below questions too:
- git how to stage
- git stage vs commit
- git stage command
- git stage all
- git stage vs add
- git stage example
- what is staging in git
- git staged files list