Skip to content

Instantly share code, notes, and snippets.

@alancoleman
Last active June 27, 2018 08:17
Show Gist options
  • Save alancoleman/87ed807c116d7934878d227d9033bf13 to your computer and use it in GitHub Desktop.
Save alancoleman/87ed807c116d7934878d227d9033bf13 to your computer and use it in GitHub Desktop.
Git commands
# Compare branches
# Show name of files only
git diff [branch1] [branch2] --name-only
# Merge branches
# Merge with no auto commit
git merge [branch] --no-commit --no-ff
# Log
# One line log
git log --pretty=oneline -10
# Graph log
git log --all --decorate --oneline --graph
# Display status of two branches as a graph, 25 commits
git log -25 --graph --oneline [branch] [other_branch]
# Commit
# Amend to last commit
$ git commit --amend --no-edit
# Delete local branch followed by remote
$ git branch -d <branch_name>
git push origin :<branch_name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment