git-natural-language-commands / git_nl_command_test.csv
burak29's picture
Fix 3 incorrect rows: fetch.tagOpt -> tag.followTags, remote-branch switch --track, reword PR-branches label
93a374b verified
Raw History Blame Contribute Delete
76.9 kB
"en_natural_language","corresponding_git_command"
"push my changes","git push"
"push the commits to the remote repository","git push"
"upload my local commits to the remote","git push"
"pull the latest changes","git pull"
"get the latest changes from the remote","git pull"
"show the current repository status","git status"
"check which files have changed","git status"
"stage all changed files","git add ."
"add all changes to the staging area","git add ."
"stage the file app.py","git add app.py"
"commit the staged changes with the message fix bug","git commit -m ""fix bug"""
"create a commit with the message update readme","git commit -m ""update readme"""
"show the commit history","git log"
"display recent commits","git log"
"show the differences in unstaged files","git diff"
"show what has changed since the last commit","git diff"
"create a branch named dev","git branch dev"
"make a new branch called feature-login","git branch feature-login"
"switch to the dev branch","git switch dev"
"change to the main branch","git switch main"
"create and switch to a branch named test","git switch -c test"
"merge the dev branch into the current branch","git merge dev"
"merge feature-login into the current branch","git merge feature-login"
"list all local branches","git branch"
"show all branches including remote branches","git branch -a"
"clone the repository from https://github.com/example/project.git","git clone https://github.com/example/project.git"
"remove file.txt from git and the working directory","git rm file.txt"
"rename old.txt to new.txt","git mv old.txt new.txt"
"show the configured remote repositories","git remote -v"
"fetch changes from the remote without merging them","git fetch"
"initialize a new git repository in the current folder","git init"
"start tracking this project with git","git init"
"create a new empty git repository here","git init"
"turn this directory into a git repository","git init"
"set up a fresh git repo","git init"
"create a new git repository in a folder called my-project","git init my-project"
"initialize an empty git repository in the docs directory","git init docs"
"begin version control for this project","git init"
"make this folder a git repository","git init"
"initialize git with the main branch as default","git init -b main"
"initialize a repository whose initial branch is called trunk","git init -b trunk"
"clone the repository at git@github.com:user/repo.git","git clone git@github.com:user/repo.git"
"download a copy of the repo from https://github.com/user/repo.git","git clone https://github.com/user/repo.git"
"clone https://github.com/user/repo.git into a directory named myapp","git clone https://github.com/user/repo.git myapp"
"clone https://github.com/user/repo.git to my machine","git clone https://github.com/user/repo.git"
"clone only the most recent commit of https://github.com/user/repo.git","git clone --depth 1 https://github.com/user/repo.git"
"make a shallow clone of the upstream repo at https://github.com/user/repo.git","git clone --depth 1 https://github.com/user/repo.git"
"clone https://github.com/user/repo.git with all of its submodules","git clone --recurse-submodules https://github.com/user/repo.git"
"clone https://github.com/user/repo.git including its submodules","git clone --recurse-submodules https://github.com/user/repo.git"
"clone only the main branch of https://github.com/user/repo.git","git clone --single-branch --branch main https://github.com/user/repo.git"
"clone https://github.com/user/repo.git and check out the develop branch","git clone -b develop https://github.com/user/repo.git"
"get a local copy of https://github.com/user/repo.git","git clone https://github.com/user/repo.git"
"clone the repository from https://github.com/me/repo.git","git clone https://github.com/me/repo.git"
"clone https://github.com/user/repo.git locally","git clone https://github.com/user/repo.git"
"clone git@github.com:user/repo.git over ssh","git clone git@github.com:user/repo.git"
"set my git username to john doe","git config user.name ""john doe"""
"set the commit author name to john doe for this repository","git config user.name ""john doe"""
"set my email address to john@example.com for git commits","git config user.email ""john@example.com"""
"configure john@example.com as the email used in my commits","git config user.email ""john@example.com"""
"set my git identity name to john doe globally","git config --global user.name ""john doe"""
"save john@example.com as my git email in the global config","git config --global user.email ""john@example.com"""
"set the default git editor to vim","git config --global core.editor vim"
"make vim my default git editor for core.editor","git config --global core.editor vim"
"show all git configuration settings","git config --list"
"list my current git configuration","git config --list"
"show the global git config","git config --global --list"
"tell git to use the name john doe for my commits globally","git config --global user.name ""john doe"""
"set the config init.defaultbranch so new repositories default to main","git config --global init.defaultBranch main"
"configure git to remember my credentials with the store helper","git config --global credential.helper store"
"enable git to cache my login credentials","git config --global credential.helper cache"
"set the default push behavior to simple","git config --global push.default simple"
"set core.autocrlf to true so git treats line endings properly on windows","git config --global core.autocrlf true"
"set core.autocrlf to input for linux","git config --global core.autocrlf input"
"set the pull.rebase config to true","git config --global pull.rebase true"
"configure pull.rebase so pulls rebase instead of merge by default","git config --global pull.rebase true"
"open the git configuration file in an editor","git config --global --edit"
"check what my git username is set to","git config user.name"
"show the configured user email","git config user.email"
"add a remote named origin pointing to https://github.com/user/repo.git","git remote add origin https://github.com/user/repo.git"
"connect my local repo to the github remote at https://github.com/user/repo.git","git remote add origin https://github.com/user/repo.git"
"register a new remote called upstream at https://github.com/original/repo.git","git remote add upstream https://github.com/original/repo.git"
"add the original repository as an upstream remote","git remote add upstream https://github.com/original/repo.git"
"show the list of remotes","git remote"
"list the remote repositories connected to this repo","git remote"
"show remotes with their urls","git remote -v"
"display the fetch and push urls of my remotes","git remote -v"
"remove the remote named origin","git remote remove origin"
"delete the origin remote","git remote remove origin"
"delete the remote called upstream","git remote remove upstream"
"change the url of the origin remote to https://github.com/user/newrepo.git","git remote set-url origin https://github.com/user/newrepo.git"
"update the origin remote to point to https://github.com/user/newrepo.git","git remote set-url origin https://github.com/user/newrepo.git"
"rename the remote origin to upstream","git remote rename origin upstream"
"rename a remote repository reference","git remote rename origin upstream"
"show details about the origin remote","git remote show origin"
"check the health of the origin remote","git remote show origin"
"add a second remote named backup at https://github.com/user/backup.git","git remote add backup https://github.com/user/backup.git"
"push my commits to origin","git push"
"send my local commits to the remote repository","git push"
"upload my work to github","git push"
"publish my commits on the remote","git push"
"sync my commits with the remote","git push"
"push the current branch to origin","git push origin"
"push my local branch to the remote","git push origin"
"push the main branch to origin","git push origin main"
"push master to the remote","git push origin master"
"push my feature branch to origin","git push origin feature/login"
"push the branch called bugfix to the remote","git push origin bugfix"
"push the current branch and set upstream tracking","git push -u origin main"
"push and link my branch to origin for the first time","git push -u origin main"
"push the new branch feature/signup and set it to track origin","git push -u origin feature/signup"
"push the develop branch and set upstream tracking","git push -u origin develop"
"push all local branches to the remote","git push --all origin"
"push every branch to origin","git push --all"
"push all my tags to the remote","git push --tags"
"upload my tags to the remote repository","git push --tags"
"push a single tag named v1.0.0","git push origin v1.0.0"
"publish the release tag v1.0.0 on the remote","git push origin v1.0.0"
"force push my branch to origin","git push --force"
"overwrite the remote branch with my local history","git push --force"
"force push to the feature branch","git push --force origin feature/login"
"force push but keep the remote branch safe with a lease","git push --force-with-lease"
"push after rebasing using a safer force push","git push --force-with-lease"
"delete the remote branch called old-feature","git push origin --delete old-feature"
"remove the feature branch from the remote","git push origin --delete feature/old"
"push and delete the obsolete remote branch feature/old","git push origin --delete feature/old"
"push commits to a specific remote called gitlab","git push gitlab main"
"send my commits to the upstream remote","git push upstream main"
"push the current branch to a remote named staging","git push staging"
"pull the newest commits from origin","git pull"
"fetch and merge changes from the remote","git pull"
"update my local branch with remote changes","git pull"
"get the latest code from the remote repository","git pull"
"pull changes from origin main","git pull origin main"
"update the main branch from the remote","git pull origin main"
"pull the latest develop branch","git pull origin develop"
"sync the current branch with origin","git pull origin"
"pull with rebase instead of merge","git pull --rebase"
"rebase my local commits on top of the remote changes","git pull --rebase"
"pull keeping my local commits on top","git pull --rebase origin main"
"pull all remotes and tags","git pull --all"
"pull the upstream remote into my fork","git pull upstream main"
"get updates from the original repo into my local main","git pull upstream main"
"fetch the latest changes from origin","git fetch origin"
"download remote updates without merging","git fetch"
"sync remote branch info without touching my work","git fetch"
"fetch all remotes","git fetch --all"
"download data from every remote","git fetch --all"
"fetch and remove stale remote-tracking branches","git fetch --prune"
"prune deleted remote branches while fetching","git fetch -p"
"fetch the tags from the remote","git fetch --tags"
"fetch only the main branch from origin","git fetch origin main"
"get the remote state of the develop branch","git fetch origin develop"
"fetch the upstream repository","git fetch upstream"
"fetch new commits from the original project","git fetch upstream main"
"fetch all branches and tags from origin","git fetch origin --tags"
"stage the changes in readme.md","git add readme.md"
"add the readme file to staging","git add readme.md"
"track the new file main.js","git add main.js"
"stage the src directory","git add src/"
"add everything in the src folder to the index","git add src/"
"stage all modified and new files","git add ."
"stage everything in the repository","git add ."
"add all files in the current directory","git add ."
"stage the whole project","git add ."
"add all changes across the entire repo","git add -A"
"stage every change including deletions","git add -A"
"stage all modifications anywhere in the repo","git add --all"
"update already tracked files in the staging area","git add -u"
"stage changes to tracked files only","git add -u"
"stage only the updated files","git add --update"
"stage all python files","git add *.py"
"add every javascript file with the .js extension to staging","git add *.js"
"stage the config folder and its files","git add config/"
"interactively choose which changes to stage","git add -i"
"stage parts of a file interactively","git add -p"
"select hunks to stage one by one","git add -p"
"add specific parts of the changes to the index","git add --patch"
"stage the remaining changes interactively","git add -p ."
"stage the deleted file deleted_file.txt","git add deleted_file.txt"
"dry run the staging of all changes","git add -n ."
"preview which files would be staged","git add --dry-run ."
"stage the file tests/test_app.py","git add tests/test_app.py"
"add both index.html and styles.css to staging","git add index.html styles.css"
"stage index.html and styles.css at once","git add index.html styles.css"
"force add an ignored file named secret.key","git add -f secret.key"
"commit with the message add login feature","git commit -m ""add login feature"""
"commit my staged changes with the message add login feature","git commit -m ""add login feature"""
"record the staged changes in history with the message add login feature","git commit -m ""add login feature"""
"create a commit with the message fix crash on startup","git commit -m ""fix crash on startup"""
"commit with a detailed message using the editor","git commit"
"commit the staged changes and write a message in the editor","git commit"
"commit all modified tracked files with the message cleanup code without staging first","git commit -a -m ""cleanup code"""
"commit every tracked change with the message cleanup code","git commit -am ""cleanup code"""
"stage and commit tracked files in one step with the message cleanup code","git commit -am ""cleanup code"""
"amend the last commit message to correct message","git commit --amend -m ""correct message"""
"fix the message of my most recent commit to correct message","git commit --amend -m ""correct message"""
"add the staged file to the previous commit","git commit --amend --no-edit"
"include my last minute change in the previous commit","git commit --amend --no-edit"
"amend the last commit without changing its message","git commit --amend --no-edit"
"commit with the multiline message title and body text","git commit -m ""title"" -m ""body text"""
"create a commit with the title title and the description body text","git commit -m ""title"" -m ""body text"""
"commit only the staged files with the message wip","git commit -m ""wip"""
"sign off the commit with the message add feature","git commit -s -m ""add feature"""
"create a gpg signed commit with the message secure change","git commit -S -m ""secure change"""
"commit with the message quick fix without running the pre commit hooks","git commit -m ""quick fix"" --no-verify"
"commit with the message quick fix and skip the hooks","git commit -m ""quick fix"" --no-verify"
"create an empty commit with the message trigger ci for ci testing","git commit --allow-empty -m ""trigger ci"""
"create an empty commit with the message trigger ci to retrigger the pipeline","git commit --allow-empty -m ""trigger ci"""
"commit the changes with the message janes fix and the author marked as jane","git commit --author=""jane <jane@example.com>"" -m ""janes fix"""
"commit with the message add tests supplied on the command line","git commit -m ""add tests"""
"show the state of the working tree and index","git status"
"what files are modified or staged","git status"
"list the current branch and pending changes","git status"
"give me a short summary of the repository status","git status -s"
"show the status in short format","git status -s"
"show a compact status output","git status --short"
"show status including untracked files","git status -u"
"list every untracked file individually","git status -uall"
"show the status in the default long format","git status"
"check if there is anything to commit","git status"
"see which branch i am on and what changed","git status"
"display modified files ready for commit","git status"
"delete the file config.yml from the repo","git rm config.yml"
"remove obsolete.txt from git and disk","git rm obsolete.txt"
"stop tracking notes.txt and delete it","git rm notes.txt"
"remove secret.env from the index but keep it on disk","git rm --cached secret.env"
"untrack the credentials file secret.env without deleting it locally","git rm --cached secret.env"
"stop tracking temp.log but keep my local copy","git rm --cached temp.log"
"remove the old_folder directory from the repository","git rm -r old_folder/"
"delete the directory build from the repo","git rm -r build/"
"recursively remove the cache directory from git","git rm -r cache/"
"remove all files with the log extension","git rm *.log"
"delete every tracked log file","git rm *.log"
"remove draft.md even if it has local changes","git rm -f draft.md"
"force remove the locked file draft.md from git","git rm -f draft.md"
"move file.txt into the docs folder","git mv file.txt docs/"
"move run.sh into the scripts directory","git mv run.sh scripts/"
"rename component.jsx to button.jsx","git mv component.jsx button.jsx"
"rename the folder utils to helpers","git mv utils helpers"
"move img/logo.png and rename it to assets/brand.png in one step","git mv img/logo.png assets/brand.png"
"change the file name from temp.py to main.py","git mv temp.py main.py"
"create a branch called hotfix","git branch hotfix"
"make a new branch for the release","git branch release/1.2"
"create a feature branch named feature/search","git branch feature/search"
"list my local branches","git branch"
"show all branches in this repository","git branch -a"
"list local and remote branches","git branch -a"
"show only the remote branches","git branch -r"
"list branches on the remote","git branch -r"
"show all branches with their latest commits","git branch -v"
"list branches verbosely with last commit info","git branch -v"
"delete the merged branch called feature-x","git branch -d feature-x"
"delete the merged branch feature-x","git branch -d feature-x"
"delete the branch hotfix regardless of merge status","git branch -D hotfix"
"force delete the unfinished branch experimental","git branch -D experimental"
"rename the current branch to main","git branch -m main"
"rename branch dev to development","git branch -m dev development"
"create a branch named backup at the commit abc1234","git branch backup abc1234"
"create the branch backup from the commit abc1234","git branch backup abc1234"
"create a branch named hotfix from the tag v1.0.0","git branch hotfix v1.0.0"
"show branches merged into the current branch","git branch --merged"
"list branches that are already merged","git branch --merged"
"list branches not yet merged into main","git branch --no-merged main"
"show which branches contain commit abc1234","git branch --contains abc1234"
"set the upstream of the current branch to origin/main","git branch -u origin/main"
"track the origin main branch","git branch -u origin/main"
"create a branch named staging from main","git branch staging main"
"copy the current branch to a branch called backup","git branch backup"
"checkout the branch called release","git checkout release"
"switch my working copy to the main branch","git checkout main"
"move to the develop branch","git checkout develop"
"create a new branch named ui-fix and switch to it","git checkout -b ui-fix"
"start a new branch named ui-fix from the current state","git checkout -b ui-fix"
"create and move to a branch called experiment","git checkout -b experiment"
"create a new branch named hotfix from the main branch","git checkout -b hotfix main"
"create a new branch named feature based on origin/main","git checkout -b feature origin/main"
"restore the file index.html to its last committed state","git checkout -- index.html"
"discard my local changes to styles.css","git checkout -- styles.css"
"revert the unstaged edits in main.py","git checkout -- main.py"
"checkout the file utils.py from the main branch","git checkout main -- utils.py"
"get the version of config.json from main","git checkout main -- config.json"
"restore the deleted file lost_file.txt from the last commit","git checkout -- lost_file.txt"
"detach head onto the commit abc1234","git checkout abc1234"
"check out the code as it was at the commit abc1234","git checkout abc1234"
"checkout the tag v2.0.0","git checkout v2.0.0"
"switch to the code state of the tag v2.0.0","git checkout v2.0.0"
"go back to the previous branch i was on","git checkout -"
"checkout the branch i was last on","git checkout -"
"create a local branch tracking origin release","git checkout -b release origin/release"
"create a local branch release tracking origin/release so i can work on it","git checkout -b release origin/release"
"switch over to the feature branch","git switch feature/login"
"change my current branch to staging","git switch staging"
"jump to the main branch","git switch main"
"create and switch to a branch called bug-123","git switch -c bug-123"
"make a new branch named bug-123 and move to it","git switch -c bug-123"
"create a branch named fix from main and switch to it","git switch -c fix main"
"start a new branch named fix off main and check it out","git switch -c fix main"
"switch to the previous branch","git switch -"
"toggle back to my last checked out branch","git switch -"
"detach head at the commit 9a8b7c6","git switch --detach 9a8b7c6"
"detach head at the older commit 9a8b7c6","git switch --detach 9a8b7c6"
"switch to the remote branch origin develop","git switch --track origin/develop"
"refuse to switch if i have uncommitted changes","git switch main"
"switch branches and discard nothing","git switch main"
"show the commit log","git log"
"view the history of commits","git log"
"list previous commits","git log"
"see the recent commit history","git log"
"show the last 5 commits","git log -5"
"display the five most recent commits","git log -5"
"show the last ten commits","git log -10"
"show only the 3 latest commits","git log -3"
"show the commit history in one line per commit","git log --oneline"
"view a compact commit history","git log --oneline"
"show recent commits in a single line format","git log --oneline"
"show an oneline log of the last 10 commits","git log --oneline -10"
"show commits with a graph of branches","git log --graph"
"visualize the branch history","git log --graph"
"show a decorated graph of all commits","git log --graph --oneline --decorate"
"show the history with branch and tag names","git log --oneline --decorate"
"show commits from only the main branch","git log main"
"view the log of the develop branch","git log develop"
"show commits by the author jane","git log --author=""jane"""
"filter the commit history by the author name jane","git log --author=""jane"""
"show commits made this week","git log --since=""1 week ago"""
"list commits from the last month","git log --since=""1 month ago"""
"show commits until yesterday","git log --until=""yesterday"""
"show only merge commits","git log --merges"
"list all the merge commits in history","git log --merges"
"hide merge commits from the log","git log --no-merges"
"show commits that touched the file app.py","git log -- app.py"
"show the history of the readme file","git log -- readme.md"
"see which commits changed the src folder","git log -- src/"
"show the full diff of each commit","git log -p"
"show the patches introduced by each commit","git log -p"
"show the log with file change statistics","git log --stat"
"display commit summary with changed file counts","git log --stat"
"search commits whose message mentions login","git log --grep=""login"""
"find commits with fix in the message","git log --grep=""fix"""
"show only the most recent single commit","git log -1"
"show the details of the most recent commit","git log -1"
"follow the history of the file config.py across renames","git log --follow -- config.py"
"track changes to config.py across renames","git log --follow -- config.py"
"show log entries with abbreviated hashes","git log --abbrev-commit"
"show all commits across all branches","git log --all"
"view the full history of every branch","git log --all --oneline"
"show the log in reverse order","git log --reverse"
"show commit history from oldest to newest","git log --reverse"
"show uncommitted changes","git diff"
"see what i modified but not staged","git diff"
"show the differences in my working directory","git diff"
"show the staged changes","git diff --staged"
"show what is staged for the next commit","git diff --cached"
"preview the changes i am about to commit","git diff --cached"
"diff the working tree against the last commit","git diff HEAD"
"show all changes compared to head","git diff HEAD"
"compare the two branches main and develop","git diff main develop"
"show what differs between main and my feature branch","git diff main feature/login"
"show changes to the file index.html","git diff index.html"
"see the diff of app.py only","git diff app.py"
"compare app.py between the main and develop branches","git diff main develop -- app.py"
"show only the names of changed files","git diff --name-only"
"list the files that changed","git diff --name-only"
"show changed file names and change stats","git diff --stat"
"summarize the diff with per-file line counts","git diff --stat"
"show the diff of commit abc1234 against its parent","git diff abc1234^ abc1234"
"see what the commit abc1234 changed","git diff abc1234^ abc1234"
"compare my current work with the origin main branch","git diff origin/main"
"show the difference between my branch and origin/main","git diff origin/main"
"show word level differences","git diff --word-diff"
"highlight changes word by word","git diff --word-diff"
"show differences ignoring whitespace","git diff -w"
"diff while ignoring all whitespace changes","git diff --ignore-all-space"
"show the diff between the tags v1.0.0 and v2.0.0","git diff v1.0.0 v2.0.0"
"compare the releases v1.0.0 and v2.0.0","git diff v1.0.0 v2.0.0"
"show binary file diffs","git diff --binary"
"show the details of the last commit","git show"
"display the latest commit with its diff","git show"
"show the commit with hash abc1234","git show abc1234"
"inspect the commit abc1234","git show abc1234"
"show what the tag v1.0.0 points to","git show v1.0.0"
"display the contents of the tag v1.0.0","git show v1.0.0"
"show the changes introduced by head","git show HEAD"
"view the most recent commit patch","git show HEAD"
"show only the file names in the last commit","git show --name-only"
"show the change stats of the commit abc1234","git show --stat abc1234"
"show the commit one before head","git show HEAD~1"
"display the commit right before head, that is head~1","git show HEAD~1"
"show who last changed each line of app.py","git blame app.py"
"annotate app.py with author information","git blame app.py"
"find who wrote each line of utils.py","git blame utils.py"
"blame the readme file line by line","git blame readme.md"
"show line by line history of main.js with emails","git blame -e main.js"
"show the blame of index.html with email addresses","git blame -e index.html"
"blame lines 10 to 20 of app.py","git blame -L 10,20 app.py"
"find the author of lines 10 to 20 in app.py","git blame -L 10,20 app.py"
"blame app.py ignoring whitespace","git blame -w app.py"
"trace app.py lines through file renames","git blame -C app.py"
"summarize commits by author","git shortlog"
"show a per author commit summary","git shortlog"
"list commit counts per contributor","git shortlog -sn"
"rank contributors by number of commits","git shortlog -sn"
"show author commit counts over all branches","git shortlog -sn --all"
"summarize the changelog by author","git shortlog -s"
"describe the current commit using the nearest tag","git describe"
"name this build based on the closest tag","git describe"
"describe the commit with any reachable tag","git describe --tags"
"get a readable name for the current commit","git describe --tags"
"list all files tracked by git","git ls-files"
"show every file under version control","git ls-files"
"list tracked files in the src folder","git ls-files src/"
"show which files are staged in the index","git ls-files --stage"
"merge the feature branch into main","git merge feature/login"
"combine the hotfix branch with the current branch","git merge hotfix"
"integrate the dev branch into my branch","git merge dev"
"merge main into my feature branch","git merge main"
"merge feature/login with the commit message merge login feature","git merge feature/login -m ""merge login feature"""
"merge feature/login creating a merge commit even if fast forward is possible","git merge --no-ff feature/login"
"force a merge commit for the feature branch","git merge --no-ff feature/login"
"merge feature/login only if it can be fast forwarded","git merge --ff-only feature/login"
"merge feature/login only when a fast forward is possible","git merge --ff-only feature/login"
"fast forward the current branch to main","git merge --ff-only main"
"abort a merge in progress and go back to the pre merge state","git merge --abort"
"cancel the conflicted merge","git merge --abort"
"stop merging and undo the conflict resolution","git merge --abort"
"continue the merge after resolving conflicts","git merge --continue"
"squash the feature branch into one commit on main","git merge --squash feature/login"
"squash merge the branch feature/search into one commit","git merge --squash feature/search"
"mark all conflicted files as resolved after fixing them","git add ."
"stage the resolved files after fixing the conflicts","git add ."
"rebase my branch onto main","git rebase main"
"replay my commits on top of the latest main","git rebase main"
"rebase the feature branch onto develop","git rebase develop feature/login"
"rebase interactively on the last 3 commits","git rebase -i HEAD~3"
"clean up my last three commits with an interactive rebase","git rebase -i HEAD~3"
"edit my last five commits interactively","git rebase -i HEAD~5"
"squash my last two commits interactively","git rebase -i HEAD~2"
"rebase onto origin main","git rebase origin/main"
"put my work on top of the remote main","git rebase origin/main"
"continue the rebase after resolving conflicts","git rebase --continue"
"resume the rebase once conflicts are fixed","git rebase --continue"
"abort the rebase and restore the original branch","git rebase --abort"
"cancel the rebase in progress","git rebase --abort"
"skip the current commit during rebase","git rebase --skip"
"skip this problematic commit and keep rebasing","git rebase --skip"
"rebase without automatically stashing changes","git rebase --autostash main"
"rebase the last 10 commits interactively","git rebase -i HEAD~10"
"reword the message of one of my last four commits with an interactive rebase","git rebase -i HEAD~4"
"cherry-pick the commit abc1234","git cherry-pick abc1234"
"cherry-pick the commit abc1234 onto my branch","git cherry-pick abc1234"
"copy the commit abc1234 onto this branch","git cherry-pick abc1234"
"cherry-pick the last commit from main","git cherry-pick main"
"pick the most recent commit of main into my branch","git cherry-pick main"
"apply the commits abc1234 and def5678 in sequence","git cherry-pick abc1234 def5678"
"cherry-pick the commits abc1234 and def5678 onto my branch","git cherry-pick abc1234 def5678"
"cherry-pick the commit abc1234 without committing it","git cherry-pick -n abc1234"
"apply only the changes of the commit abc1234 to the working tree","git cherry-pick --no-commit abc1234"
"continue the cherry-pick after resolving conflicts","git cherry-pick --continue"
"abort the cherry-pick operation","git cherry-pick --abort"
"cancel the current cherry-pick","git cherry-pick --abort"
"cherry-pick the range of commits from abc1234 to def5678","git cherry-pick abc1234^..def5678"
"take the commits from abc1234 to def5678 and apply them here","git cherry-pick abc1234^..def5678"
"revert the last commit","git revert HEAD"
"undo the most recent commit with a new commit","git revert HEAD"
"revert the commit abc1234","git revert abc1234"
"reverse the changes made by the commit abc1234","git revert abc1234"
"undo the changes from the commit abc1234","git revert abc1234"
"revert the commits head~1 through head","git revert HEAD~1..HEAD"
"revert the merge commit abc1234 keeping the mainline parent","git revert -m 1 abc1234"
"undo the merge commit abc1234 keeping the mainline history","git revert -m 1 abc1234"
"revert without opening the editor","git revert --no-edit HEAD"
"revert the previous commit without editing the message","git revert --no-edit HEAD"
"revert the commits abc1234 and def5678 at once","git revert abc1234 def5678"
"revert my last commit but keep the changes staged","git revert -n HEAD"
"unstage the file app.py","git reset app.py"
"remove readme.md from the staging area","git reset readme.md"
"unstage all files from the index","git reset"
"reset the index to the last commit without touching my files","git reset"
"reset the index to the head commit","git reset HEAD"
"unstage all the files i added to the index","git reset HEAD"
"hard reset to the last commit discarding all changes","git reset --hard"
"throw away all my local changes","git reset --hard"
"reset my working directory to match head","git reset --hard HEAD"
"reset the branch to origin main","git reset --hard origin/main"
"make my branch exactly match the remote main","git reset --hard origin/main"
"discard everything and reset my branch to origin/main","git reset --hard origin/main"
"reset the branch back two commits keeping the changes in the working tree","git reset HEAD~2"
"undo the last commit keeping the files in the working tree","git reset HEAD~1"
"soft reset the last commit keeping the changes staged","git reset --soft HEAD~1"
"undo the last commit keeping everything staged","git reset --soft HEAD~1"
"soft reset the last commit so i can redo it","git reset --soft HEAD~1"
"mixed reset to the commit two before head","git reset HEAD~2"
"hard reset the branch to the commit abc1234","git reset --hard abc1234"
"roll the branch back to the old commit abc1234 completely","git reset --hard abc1234"
"unstage config.py which i just added","git reset HEAD -- config.py"
"reset only the index for the tests folder","git reset -- tests/"
"restore app.py to its last committed version","git restore app.py"
"discard my edits to index.html","git restore index.html"
"throw away the local changes in styles.css","git restore styles.css"
"undo modifications in the working tree","git restore ."
"revert all unstaged changes","git restore ."
"unstage the file main.py","git restore --staged main.py"
"remove utils.js from the staging area","git restore --staged utils.js"
"unstage all files","git restore --staged ."
"clear the entire staging area","git restore --staged ."
"restore app.py from the main branch","git restore --source main app.py"
"get the main branch version of app.py back","git restore --source main app.py"
"restore app.py from two commits ago","git restore --source HEAD~2 app.py"
"restore both staged and unstaged changes to readme","git restore --staged --worktree readme.md"
"stash my current changes","git stash"
"save my uncommitted work temporarily in a stash","git stash"
"put my uncommitted changes away for now in a stash","git stash"
"shelve my current modifications in a stash","git stash push"
"stash my changes with the description work in progress on login","git stash push -m ""work in progress on login"""
"save my work in progress in a stash with the message work in progress on login","git stash push -m ""work in progress on login"""
"stash including untracked files","git stash -u"
"stash even the new files not yet tracked","git stash -u"
"stash all changes including ignored files","git stash -a"
"stash only the staged changes","git stash --staged"
"list my stashes","git stash list"
"show all my saved stashes","git stash list"
"show the contents of the latest stash as a diff","git stash show"
"show what is inside the most recent stash as a patch","git stash show -p"
"show the full diff of the top stash","git stash show -p"
"apply the latest stash without removing it from the stash list","git stash apply"
"bring back my stashed changes","git stash apply"
"restore the last stashed work without removing it from the stash","git stash apply"
"apply the stash at position stash@{1} in the list","git stash apply stash@{1}"
"pop the latest stash","git stash pop"
"restore my stashed changes and delete the stash entry in one step","git stash pop"
"apply and remove the top stash entry in one step","git stash pop"
"pop the stash saved at stash@{2}","git stash pop stash@{2}"
"drop the latest stash","git stash drop"
"delete the most recent stash entry from the stash list","git stash drop"
"drop the stash entry stash@{1}","git stash drop stash@{1}"
"clear all my stashes","git stash clear"
"delete all my saved stashes","git stash clear"
"create a branch named fix-branch from my stash","git stash branch fix-branch"
"tag the current commit as v1.0.0","git tag v1.0.0"
"create the tag v1.0.0 for this release","git tag v1.0.0"
"mark this point in history with the tag v1.0.0","git tag v1.0.0"
"create an annotated tag v2.0.0 with the message release version 2","git tag -a v2.0.0 -m ""release version 2"""
"make a signed annotated tag v2.0.0 with the message release version 2","git tag -a v2.0.0 -m ""release version 2"""
"tag the commit abc1234 as v0.9.0","git tag v0.9.0 abc1234"
"tag the older commit abc1234 as v0.9.0","git tag v0.9.0 abc1234"
"list all tags","git tag"
"show the tags in this repository","git tag"
"list tags matching the pattern v1*","git tag -l ""v1*"""
"show all tags starting with v1","git tag -l ""v1*"""
"delete the tag v1.0.0","git tag -d v1.0.0"
"delete the local tag v1.0.0","git tag -d v1.0.0"
"delete the tag v1.0.0 on the remote","git push origin --delete v1.0.0"
"remove the release tag v1.0.0 from origin","git push origin --delete v1.0.0"
"push my new tag v1.0.0 to the remote","git push origin v1.0.0"
"show the details and annotation of the tag v1.0.0","git show v1.0.0"
"remove untracked files","git clean -f"
"delete the new files not under version control","git clean -f"
"clean untracked files from the working tree","git clean -f"
"remove untracked files and directories","git clean -fd"
"delete untracked folders too","git clean -fd"
"clean the working tree of all untracked content","git clean -fd"
"remove untracked files including ignored ones","git clean -fdx"
"wipe all build artifacts and ignored files","git clean -fdx"
"do a deep clean including gitignored files","git clean -fdx"
"show what would be removed without deleting","git clean -nd"
"dry run the clean command","git clean -nd"
"preview which untracked files would be deleted","git clean -n"
"remove only the ignored files","git clean -fX"
"clean only the build output directory","git clean -f build/"
"show the reference log","git reflog"
"show the history of head movements","git reflog"
"list my recent head positions to find a lost commit","git reflog"
"show the reflog of the main branch","git reflog main"
"view the reflog entries for the current branch","git reflog show"
"recover a lost commit by hard resetting to its reflog entry","git reset --hard HEAD@{2}"
"search for the word todo in tracked files","git grep ""todo"""
"find occurrences of login in the repository","git grep ""login"""
"grep the codebase for the function name parse_config","git grep ""parse_config"""
"search for the word import only in python files","git grep ""import"" -- ""*.py"""
"search the code for config in the src folder","git grep ""config"" -- src/"
"grep for the word function showing line numbers","git grep -n ""function"""
"count the matches of the word error per file","git grep -c ""error"""
"search case insensitively for the keyword warning","git grep -i ""warning"""
"search for the word feature in the code at the tag v1.0.0","git grep ""feature"" v1.0.0"
"start a bisect session to find a bug","git bisect start"
"begin binary searching for the bad commit","git bisect start"
"mark the current commit as bad in bisect","git bisect bad"
"tell git the current commit is broken","git bisect bad"
"mark commit abc1234 as the bad commit","git bisect bad abc1234"
"mark the current commit as good","git bisect good"
"say this version works fine during bisect","git bisect good"
"mark commit abc1234 as the last known good commit","git bisect good abc1234"
"end the bisect session","git bisect reset"
"finish bisecting and return to my branch","git bisect reset"
"skip this commit during bisect","git bisect skip"
"let the script test.sh decide good or bad commits automatically","git bisect run test.sh"
"create a worktree for the hotfix branch","git worktree add ../hotfix-wt hotfix"
"check out the hotfix branch in a separate worktree folder","git worktree add ../hotfix-wt hotfix"
"check out feature/login in another directory to work on two branches at once","git worktree add ../feature-wt feature/login"
"list all my worktrees","git worktree list"
"show the active working trees","git worktree list"
"remove the worktree at ../hotfix-wt","git worktree remove ../hotfix-wt"
"remove the worktree at the hotfix directory registration","git worktree remove ../hotfix-wt"
"prune stale worktree references","git worktree prune"
"create a bundle file repo.bundle with the whole repository","git bundle create repo.bundle --all"
"pack the repo with its history into the bundle file repo.bundle","git bundle create repo.bundle --all"
"create a bundle of only the main branch in main.bundle","git bundle create main.bundle main"
"clone the repository from the bundle file repo.bundle","git clone repo.bundle"
"verify that the bundle file repo.bundle is valid","git bundle verify repo.bundle"
"add the library repo https://github.com/user/lib.git as a submodule","git submodule add https://github.com/user/lib.git libs/lib"
"include the repository https://github.com/user/lib.git as a submodule at libs/lib","git submodule add https://github.com/user/lib.git libs/lib"
"initialize the submodules after cloning","git submodule init"
"set up the local submodule configuration","git submodule init"
"fetch and check out all submodules","git submodule update"
"update the submodules to their recorded commits","git submodule update"
"initialize and update all submodules in one step","git submodule update --init --recursive"
"clone and pull all nested submodules","git submodule update --init --recursive"
"list the submodules of this project","git submodule status"
"show submodule states and commits","git submodule status"
"update the submodule to its latest commit","git submodule update --remote"
"export the current code as a zip archive named project.zip","git archive --format=zip -o project.zip HEAD"
"create a zip of the project at head","git archive --format=zip -o project.zip HEAD"
"create a tarball named main.tar of the main branch","git archive --format=tar -o main.tar main"
"export the tag v1.0.0 as the tar.gz file release.tar.gz","git archive --format=tar.gz -o release.tar.gz v1.0.0"
"pack the release v1.0.0 into the tar.gz archive release.tar.gz","git archive --format=tar.gz -o release.tar.gz v1.0.0"
"create patch files from the last 3 commits","git format-patch -3"
"generate patches for my recent commits","git format-patch -3"
"create a patch file for the last commit","git format-patch -1 HEAD"
"export commits as email ready patches","git format-patch origin/main"
"make patches for all commits not on main","git format-patch origin/main"
"apply the patch file fix.patch to my branch","git am fix.patch"
"apply the emailed patch file fix.patch","git am fix.patch"
"apply the patch file changes.patch without committing","git apply changes.patch"
"check whether the patch file changes.patch applies cleanly","git apply --check changes.patch"
"create a diff file of my changes","git diff > changes.patch"
"save my uncommitted diff as the patch file changes.patch","git diff > changes.patch"
"garbage collect loose objects","git gc"
"clean up and optimize the repository","git gc"
"compress the repo and prune unneeded objects","git gc --prune=now"
"aggressively optimize the repository","git gc --aggressive"
"run a deep repository cleanup","git gc --aggressive --prune=now"
"show repository disk usage statistics","git count-objects -vH"
"check the repository for corruption","git fsck"
"verify the integrity of the object store","git fsck --full"
"add the note reviewed by team to the last commit","git notes add -m ""reviewed by team"""
"attach the note reviewed by team to the commit abc1234","git notes add -m ""reviewed by team"" abc1234"
"show the notes on commits","git notes list"
"remove the note from the commit abc1234","git notes remove abc1234"
"show the git help manual","git help"
"open help for the commit command","git help commit"
"show help for the rebase command","git help rebase"
"list available git commands","git help -a"
"show a short summary of common git commands","git help -g"
"show the git version","git --version"
"check which git version is installed","git --version"
"list what changed in each commit briefly","git whatchanged"
"create the alias st for the status command","git config --global alias.st status"
"make the alias st a shortcut for git status","git config --global alias.st status"
"set up the alias co for the checkout command","git config --global alias.co checkout"
"create the alias lol for the log oneline command","git config --global alias.lol ""log --oneline"""
"unset the alias st in the global config","git config --global --unset alias.st"
"create local tracking branches for all remote branches","git branch -r | grep -v '\->' | while read remote; do git branch --track ""${remote#origin/}"" ""$remote""; done"
"stage the fix and amend it into the last commit","git commit --amend --no-edit"
"see the changes i staged side by side","git diff --staged"
"show the diff of my branch against main up to the merge base","git diff main...HEAD"
"show the commits in main that are missing from my branch","git log HEAD..main --oneline"
"list commits on my branch missing from main","git log main..HEAD --oneline"
"show the commits ahead of origin/main","git log origin/main..HEAD --oneline"
"delete the local reference to a removed remote branch","git remote prune origin"
"prune references to branches deleted on the remote","git remote prune origin"
"rename the master branch to main","git branch -m master main"
"push the renamed main branch to origin","git push -u origin main"
"point the origin remote at my new fork https://github.com/me/fork.git","git remote set-url origin https://github.com/me/fork.git"
"see the url of the origin remote","git remote get-url origin"
"print the url of the remote named origin","git remote get-url origin"
"fetch pull request 42 as the local branch pr-42 and check it out","git fetch origin pull/42/head:pr-42 && git checkout pr-42"
"fetch the pull request 42 ref into pr-42 for review","git fetch origin pull/42/head:pr-42 && git checkout pr-42"
"soft reset to the merge base with main and commit everything as one","git reset --soft $(git merge-base main HEAD)"
"find the common ancestor of main and feature/login","git merge-base main feature/login"
"show the merge base of main and feature/login","git merge-base main feature/login"
"start an orphan branch named gh-pages with no history","git checkout --orphan gh-pages"
"create the orphan branch gh-pages for the docs site","git checkout --orphan gh-pages"
"list all files changed in the last commit","git diff-tree --no-commit-id --name-only -r HEAD"
"show the tree of the latest commit","git ls-tree HEAD"
"list the files in the commit abc1234 snapshot","git ls-tree -r abc1234 --name-only"
"find which commit deleted the string old_function","git log -S ""old_function"" --oneline"
"search history for when the string old_function was added or removed","git log -S ""old_function"" --oneline"
"show when new_feature was introduced in app.py with pickaxe","git log -S ""new_feature"" -- app.py"
"see the branches sorted by most recent commit date with short ref names","git for-each-ref --sort=-committerdate refs/heads/ --format='%(refname:short)'"
"check whether node_modules and secret.env are ignored by git","git check-ignore -v node_modules/ secret.env"
"explain why secret.env is being ignored","git check-ignore -v secret.env"
"update the index from the working tree","git update-index --refresh"
"mark the file config.local as assume unchanged locally","git update-index --assume-unchanged config.local"
"temporarily hide local changes to the tracked file config.local","git update-index --assume-unchanged config.local"
"show the commit log with dates relative to now","git log --date=relative --oneline"
"show the log with author names and relative dates in the format hash author date subject","git log --pretty=format:""%h %an %ar %s"""
"format the log output as hash author and subject","git log --pretty=format:""%h %an %s"""
"view the history formatted as hash date author subject with short dates","git log --pretty=format:""%h %ad %an %s"" --date=short"
"show the full hash of head","git rev-parse HEAD"
"get the commit id of the current head","git rev-parse HEAD"
"print the abbreviated hash of head","git rev-parse --short HEAD"
"show the root directory of the repository","git rev-parse --show-toplevel"
"find the top level folder of this repo","git rev-parse --show-toplevel"
"verify that abc1234 resolves to a valid commit object","git rev-parse --verify abc1234^{commit}"
"show the current branch name","git rev-parse --abbrev-ref HEAD"
"print the name of the branch i am on","git rev-parse --abbrev-ref HEAD"
"check whether i am inside a git repository","git rev-parse --is-inside-work-tree"
"show the type of the object abc1234","git cat-file -t abc1234"
"print the contents of the commit object abc1234","git cat-file -p abc1234"
"show the raw content of readme.md from head","git cat-file -p HEAD:readme.md"
"display readme.md as stored in the last commit","git cat-file -p HEAD:readme.md"
"show the size of the git object abc1234","git cat-file -s abc1234"
"find commits in feature/login not yet applied to main","git cherry -v main feature/login"
"show which commits of feature/login are missing from main","git cherry -v main"
"list the patches of feature/login that are not in main","git cherry main feature/login"
"compare the patch series main...feature/login against origin/main...feature/login","git range-diff main...feature/login origin/main...feature/login"
"range diff origin/main...main against origin/main...head to see how my rebased branch changed","git range-diff origin/main...main origin/main...HEAD"
"range diff the commit ranges abc1234..def5678 and abc1234..head","git range-diff abc1234..def5678 abc1234..HEAD"
"enable the rerere feature to reuse recorded conflict resolutions","git config --global rerere.enabled true"
"enable rerere so git remembers my conflict fixes","git config --global rerere.enabled true"
"show the status of my recorded rerere conflict resolutions","git rerere status"
"show the diff of the rerere cache","git rerere diff"
"forget the recorded resolution for the current conflict","git rerere forget"
"enable sparse checkout for this repository","git sparse-checkout init"
"only check out part of the repository","git sparse-checkout init"
"limit the working tree to the src folder","git sparse-checkout set src/"
"keep only the docs directory in my working copy","git sparse-checkout set docs/"
"show the current sparse checkout patterns","git sparse-checkout list"
"disable sparse checkout and restore all files","git sparse-checkout disable"
"register this repository for background maintenance","git maintenance start"
"let git optimize this repo in the background","git maintenance start"
"stop background maintenance for this repository","git maintenance stop"
"run a single maintenance task now","git maintenance run --task=gc"
"show which branch head points to","git symbolic-ref HEAD"
"read the current head reference","git symbolic-ref HEAD"
"set the default branch of a bare repository to main","git symbolic-ref HEAD refs/heads/main"
"verify the signature of the last commit","git verify-commit HEAD"
"check that a commit is properly signed","git verify-commit abc1234"
"verify the signature of the tag v1.0.0","git verify-tag v1.0.0"
"check the gpg signature on the release tag v1.0.0","git verify-tag v1.0.0"
"show the git var git author ident","git var GIT_AUTHOR_IDENT"
"show the git committer ident var git will use","git var GIT_COMMITTER_IDENT"
"find dangling commits in the repository","git fsck --lost-found"
"look for lost commits after a hard reset","git fsck --lost-found"
"create the branch recover-branch at the dangling commit abc1234","git branch recover-branch abc1234"
"blame app.py with detection of moved lines","git blame -M app.py"
"blame app.py ignoring line moves and copies","git blame -M -C app.py"
"blame app.py as it was in the tag v1.0.0","git blame v1.0.0 -- app.py"
"show the blame of main.js lines 5 to 15","git blame -L 5,15 main.js"
"show each commit with its full message format","git log --format=full"
"show the log with the status of files changed per commit","git log --name-status"
"list which files were added, modified or deleted in each commit","git log --name-status"
"show the commits between the tags v1.0.0 and v2.0.0","git log v1.0.0..v2.0.0 --oneline"
"list the commits released between v1.0.0 and v2.0.0","git log v1.0.0..v2.0.0 --oneline"
"show the log of my current branch only","git log --first-parent main"
"show only the merge history of main","git log --first-parent main"
"show local commits that are not on any remote branch","git log --branches --not --remotes --oneline"
"show commit history excluding commits authored by me","git log --not --author=""me"" --oneline"
"find commits that touched the function parse_config in parser.py","git log -L :parse_config:parser.py"
"show the evolution of parse_config in parser.py over time","git log -L :parse_config:parser.py"
"show the diff with ten lines of context","git diff -U10"
"diff with ten unified context lines","git diff -U10"
"diff the index against the commit abc1234","git diff --cached abc1234"
"compare the working tree with the commit abc1234","git diff abc1234"
"show only whether files differ not the content","git diff --name-status main"
"diff ignoring carriage return differences","git diff --ignore-cr-at-eol"
"show per word changes in plain word diff mode","git diff --word-diff=plain"
"show added and removed line counts per file for tooling","git diff --numstat"
"show added and removed line counts per file","git diff --numstat"
"create the branch release/2.0 and immediately push it","git branch release/2.0 && git push -u origin release/2.0"
"list branches sorted by the most recent committer date","git branch --sort=-committerdate"
"show my branches sorted newest first by committer date","git branch --sort=-committerdate"
"list remote branches of origin only","git branch -r --list 'origin/*'"
"show all branches containing the commit abc1234","git branch --contains abc1234"
"delete the merged local branches old-fix, cleanup-tmp and demo","git branch -d old-fix cleanup-tmp demo"
"set the upstream of main to origin main","git branch --set-upstream-to=origin/main main"
"stop tracking the remote branch","git branch --unset-upstream"
"show only the origin of my configuration values","git config --show-origin --list"
"list config values together with their source files","git config --show-origin --list"
"set init.defaultbranch so new repos default to develop","git config --global init.defaultBranch develop"
"make git push only the current branch","git config --global push.default current"
"configure git to fetch tags automatically","git config --global tag.followTags true"
"set the pull.ff config to only","git config pull.ff only"
"enable the pager for git diff output in the config","git config --global pager.diff true"
"set the diff.algorithm config to histogram","git config --global diff.algorithm histogram"
"set the diff algorithm config to histogram","git config --global diff.algorithm histogram"
"set the diff.tool config to vscode","git config --global diff.tool vscode"
"set the merge.tool config to vscode","git config --global merge.tool vscode"
"remove the user email from the local config","git config --unset user.email"
"show the color.status config value","git config --get color.status"
"set color.ui to auto for colored terminal output","git config --global color.ui auto"
"push my current branch upstream to origin with tracking","git push -u origin HEAD"
"push the current branch to origin and set upstream tracking","git push -u origin HEAD"
"upload the feature branch to the remote","git push origin feature/login"
"put my commits on the server","git push"
"send my work to the remote repo","git push"
"push my latest changes","git push"
"push everything to the remote","git push --all"
"publish this release tag v1.0.0","git push origin v1.0.0"
"push all of my local tags upstream","git push --tags"
"remove the remote branch feature/old that i deleted locally","git push origin --delete feature/old"
"force the remote branch to match my local one","git push --force-with-lease"
"grab the latest changes from the repo","git pull"
"get the newest code from origin","git pull"
"update my code with the remote","git pull"
"pull down the latest main","git pull origin main"
"bring my branch up to date with origin","git pull"
"rebase my work onto the remote branch","git pull --rebase"
"what is the current git status","git status"
"show me what changed","git status"
"show pending changes","git status"
"which files are ready to commit","git status"
"give me the working tree state","git status"
"show a brief status","git status -sb"
"stage my changes","git add ."
"add the new file newfile.py to git","git add newfile.py"
"put these changes in the staging area","git add ."
"commit my work with the message work in progress","git commit -m ""work in progress"""
"commit a checkpoint of my changes with the message save progress","git commit -m ""save progress"""
"commit the staged files with the message update feature","git commit -m ""update feature"""
"amend my last commit message to fixed message","git commit --amend -m ""fixed message"""
"add these files to the previous commit","git commit --amend --no-edit"
"commit all current changes directly with the message update all","git commit -am ""update all"""
"make a commit with the message refactor tests","git commit -m ""refactor tests"""
"show me the git history","git log"
"view past commits","git log"
"display the commit timeline","git log"
"show only the last one commit","git log -1"
"show the last 20 commits","git log -20"
"show history as a graph","git log --graph --oneline"
"what did i change","git diff"
"show my uncommitted modifications","git diff"
"show what is in the staging area","git diff --staged"
"diff my branch with main","git diff main"
"compare the working tree to head","git diff HEAD"
"list files changed between main and develop","git diff --name-only main develop"
"show me who wrote each line of app.py","git blame app.py"
"show who last touched each line of app.py","git blame app.py"
"make a branch called testing","git branch testing"
"create branch feature-x","git branch feature-x"
"switch to branch feature-x","git switch feature-x"
"go to the main branch","git switch main"
"head over to the develop branch","git checkout develop"
"check out main","git checkout main"
"create a new branch and switch to it","git switch -c new-branch"
"start working on a branch called feature-ui","git switch -c feature-ui"
"delete the local branch called demo","git branch -d demo"
"force delete the branch demo even if not merged","git branch -D demo"
"list all the branches","git branch -a"
"show me local branches only","git branch"
"rename my current branch to new-name","git branch -m new-name"
"merge main into this branch","git merge main"
"bring the changes from dev into here","git merge dev"
"merge my feature branch","git merge feature/login"
"squash merge the feature branch","git merge --squash feature/login"
"rebase my branch on the latest main","git rebase main"
"rebase my last five commits interactively to clean them up","git rebase -i HEAD~5"
"continue the ongoing rebase","git rebase --continue"
"abort this rebase","git rebase --abort"
"cancel the merge","git merge --abort"
"save my changes to the stash","git stash"
"put my work aside for a moment","git stash"
"temporarily hide my changes","git stash"
"show my stashes","git stash list"
"get my stashed changes back and remove them from the stash list","git stash pop"
"apply the last stash without dropping it","git stash apply"
"clear my stash list","git stash clear"
"include new files in the stash","git stash -u"
"create the annotated release tag v1.0.0 with the message version 1.0.0","git tag -a v1.0.0 -m ""version 1.0.0"""
"tag this commit as v2.1","git tag v2.1"
"show me all the tags","git tag"
"remove the tag v0.5","git tag -d v0.5"
"push the tag v1.0.0 to origin","git push origin v1.0.0"
"undo my last commit","git reset --soft HEAD~1"
"take back the last commit","git reset --soft HEAD~1"
"discard all my local modifications","git reset --hard"
"reset everything to the last commit","git reset --hard HEAD"
"unstage that file","git restore --staged file.py"
"remove everything from the staging area","git reset"
"revert the broken commit abc1234","git revert abc1234"
"undo the changes of the last commit","git revert HEAD"
"restore app.py to how it was before","git restore app.py"
"throw away my changes in app.py","git restore app.py"
"show my remotes","git remote -v"
"list remotes with urls","git remote -v"
"add a new remote origin with the url https://github.com/user/repo.git","git remote add origin https://github.com/user/repo.git"
"remove a remote","git remote remove origin"
"fetch from origin","git fetch origin"
"download the remote branches","git fetch"
"clean up deleted remote branches locally","git fetch --prune"
"clone the repository from https://github.com/user/repo.git","git clone https://github.com/user/repo.git"
"download the repository https://github.com/user/repo.git to my computer","git clone https://github.com/user/repo.git"
"clone https://github.com/user/repo.git into the folder myfolder","git clone https://github.com/user/repo.git myfolder"
"get a shallow clone of https://github.com/user/repo.git","git clone --depth 1 https://github.com/user/repo.git"
"set my name to john doe in git","git config --global user.name ""john doe"""
"set my email to john@example.com in git","git config --global user.email ""john@example.com"""
"check my git settings","git config --list"
"show git version info","git --version"
"pick the commit abc1234 into my branch","git cherry-pick abc1234"
"apply the single commit abc1234 from another branch","git cherry-pick abc1234"
"take this one fix from main","git cherry-pick main"
"abort the cherry pick","git cherry-pick --abort"
"delete the file file.txt from the repository","git rm file.txt"
"remove a file from version control","git rm file.txt"
"untrack the file but keep it","git rm --cached file.txt"
"move the file file.txt into the src folder","git mv file.txt src/"
"rename the file old.txt to new.txt in git","git mv old.txt new.txt"
"delete all untracked files","git clean -fd"
"remove untracked directories","git clean -fd"
"clean build artifacts","git clean -fdx"
"open a second working directory at ../wt for the branch feature/login","git worktree add ../wt feature/login"
"show my worktrees","git worktree list"
"find the commit that introduced a bug","git bisect start"
"search history for the broken commit","git bisect start"
"mark this commit as bad","git bisect bad"
"mark this commit as working","git bisect good"
"show where head has been recently","git reflog"
"help me find a lost commit","git reflog"
"amend my last commit message to say corrected message","git commit --amend -m ""corrected message"""
"add the forgotten file to my last commit without changing its message","git commit --amend --no-edit"
"undo my last commit but keep the code with a soft reset","git reset --soft HEAD~1"
"i messed up my working directory start over","git reset --hard HEAD"
"my local branch is wrong make it match origin","git reset --hard origin/main"
"i accidentally committed to main, move the commit to a branch named feature/moved","git branch feature/moved && git reset --hard HEAD~1 && git switch feature/moved"
"start a new branch named experiment without touching main","git switch -c experiment"
"i need to test something on another branch but my work is not done","git stash"
"pop my stashed work now that i am back from testing","git stash pop"
"start a bisect to find a bug introduced somewhere in the last 50 commits","git bisect start"
"i deleted a branch by accident","git reflog"
"my terminal says there are conflicts what do i do","git status"
"abort the merge because the conflicts are too messy","git merge --abort"
"finish the merge after i resolved the conflicts","git merge --continue"
"push my current branch to origin with upstream tracking so it can be reviewed","git push -u origin HEAD"
"download the project https://github.com/user/repo.git from github","git clone https://github.com/user/repo.git"
"fetch the remote and show what changed in origin/main while i was away","git fetch && git log HEAD..origin/main --oneline"
"is my branch up to date with origin","git fetch && git status"
"how far behind origin main am i","git rev-list --count HEAD..origin/main"
"count how many commits my branch is ahead of origin/main","git rev-list --count origin/main..HEAD"
"get a shallow copy of https://github.com/user/repo.git without the history","git clone --depth 1 https://github.com/user/repo.git"
"my repo is huge how do i shrink it","git gc --aggressive --prune=now"
"untrack the build directory and ignore it in gitignore","git rm -r --cached build/ && echo build/ >> .gitignore"
"untrack the file secret.env and add it to gitignore","git rm --cached secret.env && echo secret.env >> .gitignore"
"prepare a zip release archive named release.zip of head","git archive --format=zip -o release.zip HEAD"
"create patches of my commits relative to origin/main to send to a colleague","git format-patch origin/main"
"my colleague sent me the patch file their-fixes.patch, apply it","git am their-fixes.patch"
"fetch pull request 42 into the local branch pr-42 to review it locally","git fetch origin pull/42/head:pr-42 && git checkout pr-42"
"range diff my patch series feature/login against its state before the rebase","git range-diff origin/main...feature/login origin/main...feature/login@{1}"
"enable rerere so git remembers my conflict resolutions","git config --global rerere.enabled true"
"add a worktree for the branch other-branch to work on two branches at the same time","git worktree add ../other-branch other-branch"
"enable sparse checkout and limit the working tree to the docs folder","git sparse-checkout init && git sparse-checkout set docs/"
"show the commit history of the src directory to find who broke the build","git log --oneline -- src/"
"which commits changed app.py this week","git log --since=""1 week ago"" -- app.py"
"show what the release v2.0.0 included since v1.9.0","git log v1.9.0..v2.0.0 --oneline"
"show which files the commit abc1234 touched","git show --name-only abc1234"
"what is in the staging area right now","git diff --cached --stat"
"how big is this repository","git count-objects -vH"
"is my repository healthy","git fsck"
"what config file sets my user name","git config --show-origin --get user.name"
"what is my current branch","git rev-parse --abbrev-ref HEAD"
"where is the root of this repo","git rev-parse --show-toplevel"
"enable rerere so git saves my conflict resolutions","git config --global rerere.enabled true"
"set the user.name config to work identity for a second github account","git config --global user.name ""work identity"""
"store my credentials so git stops asking for my password every time","git config --global credential.helper store"
"set init.defaultbranch to main so new repos default to main","git config --global init.defaultBranch main"
"how do i see commits only by my teammate","git log --author=""teammate"" --oneline"
"how do i see the biggest files in the repo","git ls-files -z | xargs -0 ls -l | sort -k5 -rn | head -10"
"show the top level tree of the latest commit","git ls-tree HEAD"
"list all files that exist in the commit abc1234","git ls-tree -r abc1234 --name-only"
"show the diff between my staged and committed code","git diff --cached"
"list all merge conflicts","git diff --name-only --diff-filter=U"
"show which files have conflicts","git status"
"mark the conflicted file conflicted.txt as resolved","git add conflicted.txt"
"show the merge base of the current branch","git merge-base HEAD main"
"view the commit graph of all branches decorated","git log --graph --oneline --decorate --all"
"show commits reachable from head but not origin main","git log origin/main..HEAD"
"show commits on origin main missing locally","git log HEAD..origin/main"
"count the total number of commits reachable from head","git rev-list --count HEAD"
"count the commits on the main branch","git rev-list --count main"
"list tags sorted by creation date","git tag --sort=-creatordate"
"show the most recent tag name without suffix","git describe --tags --abbrev=0"
"get the latest version tag name without suffix","git describe --tags --abbrev=0"
"delete all local tags using xargs","git tag | xargs git tag -d"
"fetch from origin pruning tags deleted on the remote","git fetch --prune --prune-tags origin"
"sync my local tags with the remote by pruning and fetching","git fetch --prune --prune-tags origin"
"push the branch feature/login to a remote named gitlab","git push gitlab feature/login"
"mirror the repository to the remote named gitlab","git push --mirror gitlab"
"show the tracked files that changed on disk","git diff --name-only"
"discard the changes in the src directory","git restore src/"
"restore the deleted src directory from head","git restore --source=HEAD --staged --worktree -- src/"
"show staged files only","git diff --cached --name-only"
"show unstaged files only","git diff --name-only"
"apply the stash entry stash@{1}","git stash apply stash@{1}"
"stash my changes with the message wip checkout redesign","git stash push -m ""wip checkout redesign"""
"show the diff of the stash entry stash@{1}","git stash show -p stash@{1}"
"create a patch from the stash","git stash show -p > stash.patch"
"apply the patch file stash.patch directly","git apply stash.patch"
"revert app.py to the state of the previous commit","git restore --source=HEAD~1 app.py"
"compare the current branch with the tag v1.0.0","git diff v1.0.0 HEAD"
"show log entries touching app.py and utils.py","git log --oneline -- app.py utils.py"
"show what changed in the working tree per line","git diff --word-diff"
"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"