19 Tips For Everyday Git Use
Posted by jpluimers on 2018/01/11
Great set of tips; I’ve included to intro and ToC here so it’s easier for me to find, but all the details are at [WayBack] 19 Tips For Everyday Git Use. For each paragraph, the ToC lists the relevant command. The article itself also contains some very insightful animated images of which I included one below to get an impression.
If you are completely new to git, I suggest reading [WayBack] Git Cheat Sheet first. This article is aimed at somebody who has been using git for three months or more.
When you’ve read the article, then continue with this great open source book on Git: [WayBack] Pro Git (online) or [WayBack] 2016-03-22 version: progit-en.1084.pdf which has its own repository at [WayBack] GitHub – progit/progit2: Pro Git 2nd Edition.
Table of Contents:
- Parameters for better logging
git log --oneline --graph- Log actual changes in a file
git log -p filename- Only Log changes for some specific lines in file
git log -L 1,1:some-file.txt- Log changes not yet merged to the parent branch
git log --no-merges master..- Extract a file from another branch
git show some-branch:some-file.js- Some notes on rebasing
git pull --rebase- Remember the branch structure after a local merge
git merge --no-ff- Fix your previous commit, instead of making a new commit
git commit --amend- Three stages in git, and how to move between them
git reset --hard HEADandgit status -s- Revert a commit, softly
git revert -n- See diff-erence for the entire project (not just one file at a time) in a 3rd party diff tool
git difftool -d- Ignore the white space
git diff -w- Only “add” some changes from a file
git add -p- Discover and zap those old branches
git branch -a- Stash only some files
git stash -p- Good commit messages
- Git Auto-completion
- Create aliases for your most frequently used commands
- Quickly find a commit that broke your feature (EXTRA AWESOME)
git bisect
–jeroen
via:







Git: Learning and Streamlining… – Dave's Development Blog said
[…] read a blog post by 19 Tips For Everyday Git Use by Jeroen Wiert Pluimers and at the bottom of the post was a link to Git Pro, a free book on Git. I started reading the […]