« 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 branchgit checkout master
git pull --rebase
Rebase child branchgit checkout <childbranch>
git rebase master
Merge a patchsetpatch -p1 < /path/to/diff.diff
Create a new branchgit checkout -b <new_branch>
Display branchesgit branch
Rename branch(in desired branch) git branch -m <new_name>
Delete branchgit branch -d <localbranch>
Reset to mastergit 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 IDgit-review -d c75309a65f0c49f9b1042f578141f97506e3d2bc
you may need to install sudo apt-get git-review && git config --global --add gitreview.remote origin
Statusgit status
Revert filegit checkout <filename>
Revert all modified filesgit checkout `git status | grep modified | sed 's/\(.*modified:\s*\)//'`
Add a file to commitgit add <filename>
Add all modified files to a commitgit add `git status | grep modified | sed 's/\(.*modified:\s*\)//'`
Remove File added but not yet committedgit reset <filename>
Remove all modified files added to a commitgit reset `git status | grep modified | sed 's/\(.*modified:\s*\)//'`
« Last Edit: August 16, 2020, 11:57:27 AM by Bilgus »
Logged