Rockbox Technical Forums
Rockbox Development => Starting Development and Compiling => Topic started by: Bilgus on June 22, 2020, 10:51:32 AM
-
I figured it'd be nice to have an online document of helpful git commands
Rebase master branch
git checkout master
git pull --rebase
Rebase child branch
git checkout <childbranch>
git rebase master
Merge a patchset
patch -p1 < /path/to/diff.diff
Create a new branch
git checkout -b <new_branch>
Display branches
git branch
Rename branch
(in desired branch) git branch -m <new_name>
Delete branch
git branch -d <localbranch>
Reset to master
git reset --hard origin/master
Pull Patch from gerrit back to local by reference/#gerrit id:
git ls-remote | grep 1234
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
git pull origin refs/changes/34/1234/2
OR REVIEW WITH ID
git-review -d c75309a65f0c49f9b1042f578141f97506e3d2bc
you may need to install sudo apt-get git-review && git config --global --add gitreview.remote origin
Status
git status
Revert file
git checkout <filename>
Revert all modified files
git checkout `git status | grep modified | sed 's/\(.*modified:\s*\)//'`
Add a file to commit
git add <filename>
Add all modified files to a commit
git add `git status | grep modified | sed 's/\(.*modified:\s*\)//'`
Remove File added but not yet committed
git reset <filename>
Remove all modified files added to a commit
git reset `git status | grep modified | sed 's/\(.*modified:\s*\)//'`