Skip to content

Instantly share code, notes, and snippets.

@orbanbotond
Last active June 18, 2019 10:08
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 orbanbotond/2775517 to your computer and use it in GitHub Desktop.
Save orbanbotond/2775517 to your computer and use it in GitHub Desktop.
Git commands
List Branches Merged into a Target Branch
git branch --merged <Target Branch name>
See the changes of a file:
git log -p <path_to_the_file>
Apply patch:
git am
Creating patch:
git format-patch master..<another-branch>
Retrieve the deleted files:
git log --diff-filter=D --summary
Nice Git log which contains a lot of usefull info:
git log --graph --all --decorate=full --abbrev-commit --pretty=short
-Delete the branch 'staging' on remote 'staging':
git push staging :staging
Example:
git push origin --delete features/<feature branch>
-push the branch "newfeature" to the remote "origin":
git push origin newfeature
-create a remote branch
git push origin origin:refs/heads/new_feature_name
-list remote branches:
git branch -r
-diff between two branches:
git diff <branchone>..<another branch>
-create a branch wich tracks a remote branch
git checkout --track -b new_feature_name origin/new_feature_name
-track a remote branch
git branch --set-upstream <local_branch> <remote>/<remote_branch>
push to a remote
git push <remote> <local branch name>:<remote branch to push into>
Configures the push:
git config remote.[remoteName].push [localBranchName]:[remoteBranchName]
#git co older version
git co `git rev-list -1 --before="Oct 05 2016" develop`
#https://git-scm.com/docs/git-bisect
git bisect start
git bisect good
git bisect reset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment