Skip to content

Latest commit

 

History

History
114 lines (58 loc) · 1.65 KB

git.rst

File metadata and controls

114 lines (58 loc) · 1.65 KB

Git

Diff between branches particular file:

git diff master..IPD-122 keystone_contrib_bss/controllers.py

This just undoes a commit:

git reset --soft 0d1d7fc32

This will destroy any local modifications. Don't do it if you have uncommitted work you want to keep.

git reset --hard 0d1d7fc32

To undo git add .:

git reset

Undo git add without changing anything else:

git reset shared/build.gradle

Rebasing current branch with master:

git rebase master

Show current branch:

git branch

Show remote branches:

git branch -a

Pick a file from another branch:

git checkout master keystone_contrib_bss/config.py

Delete a remote branch:

git push origin --delete IPD-181

Deletes LOCAL branch:

git branch --delete master

Rename branch:

git branch -m old_name new_name

If you want to rename the current branch, you can simply do:

git branch -m new_name

Pushes local HEAD to remote branch. (Useful for re-initialization of remote branch if rebasing holds very very hard)

git push origin HEAD:IPD-182

Download a remote branch:

git checkout -t origin/branch-name

Change commit author at one specific commit:

git commit --amend --author="Ivan Kliuk <ivan.kliuk@gmail.com>"

Show who changed certain lines of a file:

git blame -L 1,15 79bae9e00 run_tests.sh

Comparing two branches:

git diff branch_1..branch_2