Git Advanced Command

Some Git Advanced Command
stash/rebase/blame/

git

stash

  • Often, when you’ve been working on part of your project, things are in a messy state and you want to switch branches for a bit to work on something else. The problem is, you don’t want to do a commit of half-done work just so you can get back to this point later. The answer to this issue is the git stash command.
    1
    git stash
  • this will stash current changed files to a stash point.
    1
    git stash pop
  • this will restash your stash point.

  • If you want to only stash your unstage files, use this command:

    1
    git stash save --keep-index

rebase

  • Assume the following history exists and the current branch is “topic”:
    1
    2
    3
          A---B---C topic
    /
    D---E---F---G master
  • From this point, the result of either of the following commands:
    1
    2
    git rebase master
    git rebase master topic
  • would be:
    1
    2
    3
                  A'--B'--C' topic
    /
    D---E---F---G master

Often, You can use ‘git stash’ with ‘git rebase’ to Arrange your git word directory.

blame

  • Find file’s author.
    1
    git blame [fileName with dir]

Original Link