Friday, June 30, 2017

[Quick Tip] Git: Intermediate versioning with the index.

If you use git on a daily basis then you're probably familiar with the typical:
git add somefile.txt
git commit
<Write your commit message>

One of the nice things has always been that you can do your commits locally before pushing it out to your remote repository (if you ever do that).  If you prefer expedience many people will skip the add step when they can by just using git commit -am "Commit Message". However sometimes when dealing with a non-trivial issue you may have many iterations that you can work with before what every you're doing is done. My typical method for this is to just commit and say WIP or work in progress. That way I can see where I know that the build might fail.

If I feel really motivated I may even go back to squash. However, let's say that you're not the type to commit until you have something fully working. Then I say you have a way. One of the nice features that I think many people overlook is the index. It sits in limbo between your working copy and the commit history. And it allows you to track your progress as you go along.


No comments:

Post a Comment