Cheatography
https://cheatography.com
General
Identifying a commit
Use first 4+ hash chars to identify a commit
git checkout 3e95
= git checkout 3e95b6ad46cafd97571b5c057e1ee5dace5c044b
|
Local changes
Changes in your working directory
git status
Add a single file to the next commit
git add filename
Add all current changes to the next commit
git add .
Create a new commit from the previously added files
git commit
Modify an existing commit with the previously added files
git commit --amend
Delete all unversioned files
git clean -f -n
|
|
|
Working with branches
Switching to a branch (HMI-123456)
git checkout HMI-123456
Pull HMI_master and rebase on top of it
git pull --rebase HMI_master
List all branches
git branch -a
Delete a branch (HMI-123456)
git branch -d HMI-123456
Cherry pick commit HASH to current branch
git cherry-pick HASH
|
Rewriting history
Show last 3 commits
git log -3
Resetting to the previous commit (keep changes in workarea)
git reset HEAD~1
Resetting to the previous commit (revert changes)
git reset --hard HEAD~1
Reset to any commit by hash
git reset HASH
|
|
|
Gerrit / BCI
1. Create commit
git add .
git commit -m "HMI-123456 test"
2. Create a new branch named HMI-123456
git checkout -b HMI-123456
3. Push the commit to Gerrit
git push origin HMI-123456:refs/for/HMI_master%topic=HMI-123456
or Push to Gerrit with mhg
mgit ptg HMI-123456
|
Ticket ID in the example is HMI-123456
Finding your change on Gerrit
Monitoring build progress
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets