Rockbox Development > Starting Development and Compiling

Git commands cheat sheet

(1/1)

Bilgus:
I figured it'd be nice to have an online document of helpful git commands

Rebase master branch

--- Code: ---git checkout master
git pull --rebase
--- End code ---

Rebase child branch

--- Code: ---git checkout <childbranch>
git rebase master
--- End code ---

Merge a patchset

--- Code: ---patch -p1 < /path/to/diff.diff
--- End code ---

Create a new branch

--- Code: ---git checkout -b <new_branch>
--- End code ---

Display branches

--- Code: ---git branch
--- End code ---

Rename branch
(in desired branch)
--- Code: ---git branch -m <new_name>
--- End code ---

Delete branch

--- Code: ---git branch -d <localbranch>
--- End code ---

Reset to master

--- Code: ---git reset --hard origin/master
--- End code ---


Pull Patch from gerrit back to local by reference/#gerrit id:

--- Code: ---git ls-remote | grep 1234

--- End code ---

--- Quote ---From git://git.rockbox.org/rockbox
bc9e5af34c61639ce815df9b8e4b2af860b20a2b   refs/changes/34/1234/1
c75309a65f0c49f9b1042f578141f97506e3d2bc   refs/changes/34/1234/2
2d95c8b9f2eab115dc421234b9c058b249f47e09   refs/changes/73/1073/12
5d106748ec32654ccf53718a9dac2088d12341d8   refs/changes/73/73/1
27217bfe1052401386be677212347024a1009c37   refs/tags/rbutil_1.2.11

--- End quote ---


--- Code: ---git pull origin refs/changes/34/1234/2
--- End code ---

OR REVIEW WITH ID

--- Code: ---git-review -d c75309a65f0c49f9b1042f578141f97506e3d2bc
--- End code ---

--- Code: ---you may need to install sudo apt-get git-review && git config --global --add gitreview.remote origin
--- End code ---


Status

--- Code: ---git status
--- End code ---

Revert file

--- Code: ---git checkout <filename>
--- End code ---

Revert all modified files

--- Code: ---git checkout `git status | grep modified | sed 's/\(.*modified:\s*\)//'`
--- End code ---

Add a file to commit

--- Code: ---git add <filename>
--- End code ---

Add all modified files to a commit

--- Code: ---git add `git status | grep modified | sed 's/\(.*modified:\s*\)//'`
--- End code ---

Remove File added but not yet committed

--- Code: ---git reset <filename>
--- End code ---

Remove all modified files added to a commit

--- Code: ---git reset `git status | grep modified | sed 's/\(.*modified:\s*\)//'`
--- End code ---

Navigation

[0] Message Index

Go to full version