Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
T

tips

> 开发工具
Open source

Most commonly used git tips and tricks.

21.7K stars0 likes2 views
WebsiteGitHub

About

Most commonly used git tips and tricks.

git-tips

Collection of git-tips, want to add your tips? Checkout contributing.md

English | 中文 | Русский | 한국어 | Tiếng Việt | 日本語 | नेपाली | Polski | فارسی

Tools:

  • git-tip - A handy CLI to make optimum use of these tips. (Here in Docker container)

📖 Read the interactive GitBook documentation here!

P.S: All these commands are tested on git version 2.7.4 (Apple Git-66).

Table of Contents

  • Basic Operations
    • List of all files till a commit
    • Quickly switch to the previous branch
    • Delete remote branch
    • Delete remote tag
    • Undo local changes with the content in index(staging)
    • Reword the previous commit message
    • See commit history for just the current branch
    • Amend author.
    • Stage parts of a changed file, instead of the entire file
    • Pick commits across branches using cherry-pick
    • Grab a single file from a stash
    • Create new working tree from a repository (git 2.5)
    • Create new working tree from HEAD state
    • Show all commits in the current branch yet to be merged to master
    • Modify previous commit without modifying the commit message
    • Prunes references to remove branches that have been deleted in the remote.
    • Retrieve the commit hash of the initial revision.
    • Import from a bundle
    • Ignore one file on commit (e.g. Changelog).
    • Fetch pull request by ID to a local branch
    • Restore deleted file.
    • Restore file to a specific commit-hash
    • Marks your commit as a fix of a previous commit.
    • Skip staging area during commit.
    • Interactive staging.
    • Status of ignored files.
    • Checkout a new branch without any history
    • Find guilty with binary search
    • Bypass pre-commit and commit-msg githooks
    • Clone a single branch
    • Create and switch new branch
    • Show all local branches ordered by recent commits
    • Clone a shallow copy of a repository
    • Force push to Remote Repository
    • Group commits by authors and title
    • Forced push but still ensure you don't overwrite other's work
    • Number of commits in a branch
    • Add object notes
    • Apply commit from another repository
    • Specific fetch reference
    • Generates a summary of pending changes
    • Show git status short
    • Checkout a commit prior to a day ago
    • Push the current branch to the same name on the remote repository
    • Push a new local branch to remote repository and track
    • Update a submodule to the latest commit
    • Duplicating a repository
    • Sparse checkout: clone only specific directories
    • Show output in columns
    • List worktrees
    • Remove a worktree
  • Branching
    • List all branches that are already merged into master
    • Remove branches that have already been merged with master
    • List all branches and their upstreams, as well as last commit on branch
    • Track upstream branch
    • Delete local branch
    • Get list of all local and remote branches
    • Get only remote branches
    • Find out branches containing commit-hash
    • Rename a branch
    • Archive the master branch
    • Delete local branches that has been squash and merged in the remote.
    • Export a branch with history to a file.
    • Get the name of current branch.
    • Show the most recent tag on the current branch.
    • List all branch is WIP
    • Preformatted patch file.
    • Switch to a branch (modern alternative to checkout)
  • Log and History
    • Show helpful guides that come with Git
    • Search change by content
    • Show changes over time for specific file
    • List all the conflicted files
    • List of all files changed in a commit
    • Unstaged changes since last commit
    • Changes staged for commit
    • Show both staged and unstaged changes
    • What changed since two weeks?
    • See all commits made since forking from master
    • Show all tracked files
    • Show all untracked files
    • Show all ignored files
    • Visualize the version tree.
    • Visualize the tree including commits that are only referenced from reflogs
    • Show inline word diff.
    • Show changes using common diff tools.
    • Commits in Branch1 that are not in Branch2
    • List n last commits
    • Open all conflicted files in an editor.
    • View the GPG signatures in the commit log
    • Extract file from another branch.
    • List only the root and merge commits.
    • List commits and changes to a specific file (even through renaming)
    • Search Commit log across all branches for given text
    • Get first commit in a branch (from master)
    • Show the author, time and last revision made to each line of a given file
    • Show how many lines does an author contribute
    • Show all the git-notes
    • List unpushed git commits
    • Add everything, but whitespace changes
    • blame on certain range
    • Show a Git logical variable.
    • Get the repo name.
    • logs between date range
    • Exclude author from logs
    • View expanded details of changes in last commit
    • Visualize each position of HEAD in the last 30 days
    • Compare two versions of a rebased branch
    • Automate bisect with a test script
    • Blame with line range
    • Detect moved or copied lines in blame
    • Log with graph in oneline format
    • Find commits where a file was deleted
    • Show commit count per author per time period
    • Verify commit signatures
    • Show diff with word-level granularity using color
  • Merging and Rebasing
    • Rebases 'feature' to 'master' and merges it in to master
    • Stash changes before rebasing
    • Squash fixup commits normal commits.
    • Change previous two commits with an interactive rebase.
    • Find common ancestor of two branches
    • Change a branch base
    • Create a fixup commit and auto-squash
    • Rebase interactively from the root commit
  • Miscellaneous
    • Everyday Git in twenty commands or so
    • Untrack files without deleting
    • Don’t consider changes for tracked file.
    • Check if the change was a part of a release.
    • List ignored files.
    • Count unpacked number of objects and their disk consumption.
    • Prune all unreachable objects from the object database.
    • [Instantly browse your working repository in gitweb.](#instantly-browse-your-wor

Issues· 4 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScriptgittipstips-and-tricks

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 1, 2026
Category开发工具
PricingOpen source

> Related tools

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具