Git Advanced Cheetsheet
Git is an flexible and powerful Version control system. But for must of us meir mortals it can be to powerful.
Or as XKCD puts it.
So this is my notes in the advanced parts of Git and how to make more use of this powerful tool, or more likely get yourself out of a sticky situation.
Resting back to your committed version
The first one is the one that I most often use and the simplest. Whenever you want top blow away any local changes and get back to your last commit.
git reset --hard HEAD
Unless you have somehow messed up your git repository that will git you back to the last commit.
Git commit message template
Anytime you start programing with a group of people you will start needing to decide on some Coding style guidelines and standards. Commit messages are one of these areas that a consistent style significantly improves readability.
well Git has a built in method to create commit messages based on a template.
Lets take the Netty standard for our example.
And create a file named
~/.git.commit.template with the following
Motivation: Modifications: Result:
~/.gitconfig (you may need to create this file)
[commit] template = ~/.gitmessage
Then when you go to write your commit message you will start with your template.
Better Git diffs
Go use Delta its great and the README.md is well documented.