Skip to content

Instantly share code, notes, and snippets.

@fasetto
Last active March 21, 2018 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fasetto/60e983a5f442bc978f3852dc429fc1ac to your computer and use it in GitHub Desktop.
Save fasetto/60e983a5f442bc978f3852dc429fc1ac to your computer and use it in GitHub Desktop.

Branching strategies

  • master
  • dev
  • feature
  • next
  • iss53
  • iss53v2
  • hotfix
  • testing
  • pu (proposed updates)

Advanced commands

  • git remote add origin <git-repo>.git

  • git pull

  • git pull origin master # fetch and merge

  • git log --pretty=oneline

  • git log --graph --abbrev-commit --decorate --format=format:'%C(bold red)%h%C(reset) - %C(bold green)(%ar)%C(reset) <%an>%C(reset)%C(bold yellow)%d%C(reset) %C(white)%s%C(reset) %C(dim white)' --all

  • git log --graph --oneline --decorate --all

  • git reflog

  • git branch -av

  • git branch -d <branch-name> or -D to --delete --force

  • git branch --track <branch-name>

  • git checkout -b <branch-name> <commit-id-optional>

  • git config -l

  • git config --global user.name = "SERKAN BIRCAN"

  • git config --global user.email = serkanbircan21@outlook.com

  • git config --global alias.<alias> "<alias-command>"

  • git rm --cached <file>

  • git add .

  • git commit -a -m "commit message here"

  • git commit --amend

  • git diff

  • git diff HEAD

  • git diff <commit-hash>

  • git status -v -v

  • git diff --staged

  • git reset --hard

  • git reset --hard <commit-id>

  • git reset HEAD <file-name-to-unstage>

  • git checkout -- <file-name-to-discard-changes>

  • git revert <commit-id>

  • git revert HEAD~2..HEAD

  • git revert HEAD^..HEAD

  • git remote show origin

  • git remote rename origin paul

  • git remote rm paul

  • git push -u <remote-repo> <branch-name>

  • git merge <branch-name>

  • git rebase <branch-name>

  • git stash list

  • git stash show <stash>

  • git stash show -p <stash>

  • git stash <file-name>

  • git stash apply

  • git stash pop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment