Twitter Facebook Pinterest Google+ Stumbleupon LinkedIn
GIT is one of those tools that everyone uses but I find everyone uses it in different ways. Many prefer to use the Terminal for everything, some use their IDEs and others got for whole GUIs like Git kracken. Personally after trying all sorts of ways I’ve settled on just going full terminal which I find a lot easier and consistent thanks to a few useful shortcuts.
Download the latest code from the master Branch in one command.
git fetch origin master:master
List only the commits in your current branch
git log
currentBranchName
--not master
Returns the number of commits on your current branch
git rev-list HEAD --count --not master
Replace your previous commit with a new updated one with file changes and a new commit message
git commit -am "New commit message" --amend
Tidy up commits into one, I’ve tried a few ways to tidy up my commit history with rebasing and squashes but I haven’t seen a clear benefit to it. the easiest way I’ve found is a soft reset. Replacing the 1 below with the number of commits you want to suppress.
git reset --soft HEAD~1
Posted by Adi on June 2, 2019
Leave a Reply