How I use git
When it comes to git I keep it simple. I use the basic commands which I feel are enough without getting into trouble and the helpful comments in the terminal are usually enough for me figure out what to do right.
I check git status often so I know what branch I’m on and which files I’ve modified etc..
I always make a branch separate from master to work on. When I’m ready to push changes, I’ll add my changes, commit them then push them to the branch.
When I feel my code is ready, it passes tests and I’ve created a pull request from the github interface where the code has been reviewed by others – I’ll merge master into it, then merge it into master.
If I’m done with the branch I’ll delete it, locally and remotely.
If I need to work from a branch that I don’t have locally, I’ll need to pull it down and check it out.
These are pretty much the only commands I use. If I run into trouble with a merge – I’ll pick through the problem files and look for the diff’s that git adds and sort them out – this is usually pretty rare.
There are a few other helpful commands. git stash
for instance is a nice way to “save” your changes locally and switch branches without pushing.
A few more helpful commands I will occasionally use include;