Skip to content

Instantly share code, notes, and snippets.

@thomaspuppe
Last active February 3, 2016 12:38
Show Gist options
  • Save thomaspuppe/5378650 to your computer and use it in GitHub Desktop.
Save thomaspuppe/5378650 to your computer and use it in GitHub Desktop.
git Commands

##Fetch the status from origin and ignore all local changes

git fetch --all
git reset --hard origin/master

##Change the last commit Message

git commit --amend -m "New commit message"

##Cancel a merge that is on hold due to conflicts The own commits are still available, just the merge gets cancelled/reverted.

git reset --hard HEAD

##Show files changed between two branches

git diff --stat testing..master

##Stashing

https://ariejan.net/2008/04/23/git-using-the-stash/

// hinpacken und ansehen
git stash save <optional message for later reference>
git stash list

// einzeln vom Stash holen und löschen (seperate Schritte)
git stash apply stash@{0}
git stash drop stash@{0}

// letzten vom Stash holen
git stash pop

// qickie
git stash
...
git stash pop

##Schönerer Git Log

git log --graph --decorate --pretty=oneline --abbrev-commit

Putting uncommitted changes at Master to a new branc

git checkout -b my-feature
git add .

Uncommittete Changes wandern mit rüber beim Erstellen eines neuen Branches. Eben weil sie ja noch nicht im alten drinhängen.

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