en_natural_language
stringlengths
13
134
corresponding_git_command
stringlengths
6
140
reset everything back to the tagged release v1.0.0
git reset --hard v1.0.0
move the last commit to a new branch named carry-over
git branch carry-over && git reset --hard HEAD~1 && git switch carry-over
split my work into a new branch named part-two
git switch -c part-two
soft reset the last commit to redo it with different files
git reset --soft HEAD~1
recommit the staged changes with a better message
git commit -m "better message"
check what remote branches exist on origin
git branch -r
list branches merged into main
git branch --merged main
list branches not merged into main
git branch --no-merged main
delete all branches already merged into main
git branch --merged main | grep -v main | xargs git branch -d
fetch a single branch only
git fetch origin main
pull without creating a merge commit
git pull --ff-only
rebase pull from origin main
git pull --rebase origin main
push to a new remote repository for the first time
git push -u origin main
initialize a repo, commit everything with the message initial commit, add the remote https://github.com/user/repo.git and push to main
git init && git add . && git commit -m "initial commit" && git remote add origin https://github.com/user/repo.git && git push -u origin main
set up a brand new project with git
git init
add all files and commit them with the message add everything
git add -A && git commit -m "add everything"
stage and commit all tracked changes in one command with the message quick update
git commit -am "quick update"
update the last commit and push safely
git commit --amend --no-edit && git push --force-with-lease
revert the last commit and push the revert
git revert HEAD && git push
revert the last pushed commit and push it safely
git revert HEAD && git push
hard reset the last commit away and force push safely
git reset --hard HEAD~1 && git push --force-with-lease
bring config.yml from the main branch
git checkout main -- config.yml
merge only the file config.yml from the main branch
git checkout main -- config.yml
compare app.py across the two commits abc1234 and def5678
git diff abc1234 def5678 -- app.py
see the change history of line 42 of app.py
git blame -L 42,42 app.py
show all commits between main and head
git log main..HEAD --oneline
reword the message of one of my last three commits
git rebase -i HEAD~3
reorder my last four commits interactively
git rebase -i HEAD~4
drop a bad commit from my last three commits interactively
git rebase -i HEAD~3
soft reset three commits back and commit them as one with the message combined work
git reset --soft HEAD~3 && git commit -m "combined work"
combine my last two commits into one with the message combined work
git reset --soft HEAD~2 && git commit -m "combined work"
make the working tree match the index exactly
git restore .
empty the stash without applying
git stash clear
check whether the branch feature/login exists
git rev-parse --verify feature/login
verify that the tag v1.0.0 exists
git rev-parse --verify v1.0.0^{tag}
see the reflog of head with iso dates
git reflog --date=iso
find when the branch feature/login was created from its reflog
git reflog show feature/login
set the origin remote url to https://github.com/newowner/repo.git after a repo transfer
git remote set-url origin https://github.com/newowner/repo.git
update the origin remote url to https://github.com/newowner/repo.git after the repository was renamed
git remote set-url origin https://github.com/newowner/repo.git
show the upstream branch of the current branch
git rev-parse --abbrev-ref --symbolic-full-name @{u}
check which remote branch i track
git status -sb
see the last tag name on this branch without suffix
git describe --tags --abbrev=0
find commits with the word deprecated in the message
git log --oneline --grep="deprecated"
find commits whose message mentions the issue number #123
git log --oneline --grep="#123"
show the commits between origin/main and head that will be pushed
git log origin/main..HEAD --oneline
preview the commits between origin/main and head before pushing
git log origin/main..HEAD --oneline
list the files changed in the last commit
git diff-tree --no-commit-id --name-only -r HEAD
show added lines only in the diff
git diff --diff-filter=A --name-only
list only deleted files in the diff
git diff --diff-filter=D --name-only
list modified files between head and working tree
git diff --diff-filter=M --name-only