git stash dropDelete the most recent stash entry
git log --oneline --graphDisplays condensed repository history in a graphical format.
git tag -a <version_number>Creates an annotated Git tag named `<version_number>` pointing at the current commit.
git branch --contains <commit>List local branches that include the specified commit.
git log -G<regexp>Searches commit diffs for changes matching a regex pattern.
git branch --unset-upstreamRemove the upstream tracking branch from the current branch.
git log --merge --onelineDisplays commits relevant to the current merge in a concise one-line format.
git diff --name-only --diff-filter=UList filenames of files with merge conflicts
git switch -c <branchname>Creates a new branch and switches to it.
git apply <pathname>Apply a patch file’s changes directly to the working directory
git switch <branchname>Switch to the specified branch
git describe --tagsShows the nearest tag name reachable from the current commit.
git name-rev <commit>Shows a friendly reference name for a commit hash
git describe --always --dirtyShow a short identifier for the current commit, marking it 'dirty' if there are uncommitted changes.
git notes add -m <note-text>Add a note to the current commit without altering its history
git bundle create <filename> <branchname>Bundles the commit history of <branchname> into a single file named <filename>.
git notes show <commit>Displays the note text attached to a specific commit.
git fetch --dry-runPreview remote changes without actually downloading them.
git show-ref --headsShow commit hashes and reference names for all local branches.
git count-objects -vPrints counts and disk usage of loose and packed objects in the repository.
git branch --mergedList local branches fully merged into the current branch.
git bisect stopStops the bisect session and restores the repository to its original state.
git reflogShow a log of all Git references
git fetchDownload new commits, branches, and tags from the remote without changing your current files.
git checkout -b <branchname>Create a new branch and switch to it
git branch -m <old_branchname> <new_branchname>Rename a branch
git branch -vList all branches including commit information
git rebase <branchname>reapply commits from the current branch onto <branchname>
git rebase maingit checkout -b <branchname1> <remote>/<branchname2>Clone a remote branch and switch to it
git restore --stagedRemoves files from the staging area without altering their content in the working directory.
git checkout <branchname>Switch to a different branch
git branch -M <branchname>Forcefully rename the current branch to <branchname>
git branch <branchname>Creates a new branch with the specified name.
git branch refactor-homepagegit merge <branchname>Merge the specified branch into the current branch, combining their histories.
git rm <pathname>Remove a file from the working directory and staging area.
git diff <commitA> --name-onlyShow the names of the changed files between the current commit and specific commit
git commit f8da76c --name-onlygit add <pathname>Stage changes for the next commit
git rm --cached <pathname>Remove files only from the git index
git commit -m <message>Commit staged changes with a message
git commit -m "Fix bug"git clone <repo_url>Clone a remote Git repository
git clone https://github.com/facebook/react.gitgit logShow the commit history
git blame <pathname>Annotate each line in `<pathname>` with the commit SHA, author, and timestamp of its last modification.
git blame src/file1.txtgit pullFetch and merge remote changes
git initInitialize a Git repository in the current directory
git statusShow the status of the current repository
git diff HEADShow uncommitted changes
git add -AAdd all new and changed files to the staging area
git branchList all branches
git branch -d <branchname>Delete a branch
git push Upload local commits from your current branch to its configured remote branch.
git checkout HEAD <pathname>Restore a file from the most recent commit
git config pull.rebase falseConfigures Git to merge instead of rebasing when pulling changes.
git diff @{push}Compare your working directory to the commit recorded at your last push
git log --all --grep=<searchterm>Display all commits across branches whose message contains a specified keyword.
git log -<number>Shows the last `<number>` commits in the log.
git log ..<branchname>Lists the commits that are available in <branchname> but not in the current branch
git branch -rLists all remote branches in the repository.
git stash save <message>Stash changes with a custom message
git stash popApplies the latest stashed changes to your working directory and removes that stash entry.