The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,425 other followers

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 [WayBack19 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 [WayBackGit 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: [WayBackPro 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:

  1. Parameters for better logging
    git log --oneline --graph
  2. Log actual changes in a file
    git log -p filename
  3. Only Log changes for some specific lines in file
    git log -L 1,1:some-file.txt
  4. Log changes not yet merged to the parent branch
    git log --no-merges master..
  5. Extract a file from another branch
    git show some-branch:some-file.js
  6. Some notes on rebasing
    git pull --rebase
  7. Remember the branch structure after a local merge
    git merge --no-ff
  8. Fix your previous commit, instead of making a new commit
    git commit --amend
  9. Three stages in git, and how to move between them
    git reset --hard HEAD and git status -s
  10. Revert a commit, softly
    git revert -n
  11. See diff-erence for the entire project (not just one file at a time) in a 3rd party diff tool
    git difftool -d
  12. Ignore the white space
    git diff -w
  13. Only “add” some changes from a file
    git add -p
  14. Discover and zap those old branches
    git branch -a
  15. Stash only some files
    git stash -p
  16. Good commit messages
  17. Git Auto-completion
  18. Create aliases for your most frequently used commands
  19. Quickly find a commit that broke your feature (EXTRA AWESOME)
    git bisect

–jeroen

via:

One Response to “19 Tips For Everyday Git Use”

  1. […] 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 […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: