Skip to content
kimschles edited this page Jan 2, 2019 · 7 revisions

Git Docs

  • git --help
  • git help -a

Seeing The Commit History (yours and the team's)

  • git status
  • git log --oneline
  • git log --oneline --all
  • git log --oneline --all --decorate

Merge

Rebase

  • rebase
  • rebase -i <- This one gives you options and explanations. :)
  • Usually, the command is git merge -i origin/master

Merge vs. Rebase

  • A merge preserves your branch history, while rebase does not.
  • A merge is useful for combining changes that are public
  • Rebase is good for combining changes that are only on your machine

Fetch vs. Pull

Finding the sha of a particular branch or commit

  • git show-ref

Looking at diffs

See the difference between two different shas

  • git diff sha~sha2 See the difference between your head and the last commit
  • git diff HEAD~1

Revert

  • git revert sha Revert a merge commit (choose the first sha)
  • git revert -m 1

Tags

Add a git tag: * git tag 2.1

Look at git tags: * git tag

Push up a git tag: * git push origin --tags

Learning Resources:

Look at your SSH env variable(s): env | grep -i git

  • -i means to ignore case. You can also use --ignore-case
Clone this wiki locally