Git commands

182 commands found

Getting Started

65 commands

Configure user name

Copy it and replace filenames, paths, or keywords as needed.

git config --global user.name "Your Name"
Example

Configure email

Copy it and replace filenames, paths, or keywords as needed.

git config --global user.email "you@example.com"
Example

Create a repository

Copy it and replace filenames, paths, or keywords as needed.

git init
Example

Clone a repository

Copy it and replace filenames, paths, or keywords as needed.

git clone [url]
Example

az-devops

Manage Azure DevOps organizations and projects

az devops configure --defaults organization=[https://dev.azure.com/contoso] project=[ContosoWebApp]
Details

bk

Distributed version control system

bk clone [bk://server/repository]
Details

bup

Git-based backup system with deduplication

bup init
Details

chezmoi

cross-platform dotfile manager with templating

chezmoi init
Details

ctx

Multi-environment context switcher for DevOps workflows

ctx init
Details

dagger

Programmable CI/CD engine that runs pipelines as code

dagger init --sdk=[go|python|typescript]
Details

dolt-config

manage repository and global settings

dolt config --global --add user.name "[Your Name]"
Details

dolt

SQL database with Git-like version control

dolt init
Details

dotstate

Modern dotfile manager with Git integration

dotstate init [directory]
Details

drive

command-line client for Google Drive

drive init [~/gdrive]
Details

dvc-config

manage DVC configuration settings

dvc config [core.remote] [myremote]
Details

dvc-init

Initialize Data Version Control in a repository

dvc init
Details

dvc

version control system for machine learning projects

dvc init
Details

fossil

distributed version control with integrated project management

fossil init [repo.fossil]
Details

gh-config

manage GitHub CLI settings and preferences

gh config get [key]
Details

gh

GitHub official command line interface

gh repo clone [owner]/[repo]
Details

git-agecrypt

Transparent file-level encryption for Git, powered by age

git agecrypt init
Details

git-annex

Manage large files in git without storing content in repository

git annex init "[description]"
Details

git-branchless

High-velocity Git workflow tools with smartlog and undo

git branchless init
Details

git-clone

Clone a remote repository

git clone [https://github.com/owner/repo.git]
Details

git-config

Get and set repository or global options

git config --global user.name "[Name]"
Details

Everyday Workflow

52 commands

Show working tree status

Copy it and replace filenames, paths, or keywords as needed.

git status
Example

Stage one file

May affect permissions or system state. Check the target first.

git add [file]
Example

Stage all changes

May affect permissions or system state. Check the target first.

git add .
Example

Commit staged changes

Copy it and replace filenames, paths, or keywords as needed.

git commit -m "describe the change"
Example

Push commits

Copy it and replace filenames, paths, or keywords as needed.

git push
Example

Pull remote changes

Copy it and replace filenames, paths, or keywords as needed.

git pull
Example

ansible-pull

Pull and run playbooks from a repository

ansible-pull -U [https://github.com/user/repo.git]
Details

aws-codecommit

Manage Git repositories hosted on AWS CodeCommit.

aws codecommit create-repository --repository-name [my-repo] --repository-description "[Description]"
Details

dolt-commit

record staged database table changes

dolt commit -m "[message]"
Details

dstask

Git-powered terminal todo manager

dstask add [task description]
Details

git-add

Stage changes in the working directory for next commit

git add [path/to/file]
Details

git-blame-someone-else

Rewrite commit authorship (for fixing attribution errors)

git blame-someone-else "[Author Name] <email@example.com>" [commit]
Details

git-bug

Distributed bug tracker embedded in git

git bug add
Details

git-column

Display data in columns

seq 1 24 | git column --mode=column --padding=[5]
Details

git-commit-tree

Create a commit object from a tree

echo "[message]" | git commit-tree [tree_hash]
Details

git-help

Display documentation for Git commands

git help [commit]
Details

git-hooks

Scripts triggered at Git workflow points

echo '#!/bin/sh' > .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit
Details

Branches

48 commands

List local branches

Copy it and replace filenames, paths, or keywords as needed.

git branch
Example

List all branches

Copy it and replace filenames, paths, or keywords as needed.

git branch -a
Example

Show current branch

Copy it and replace filenames, paths, or keywords as needed.

git branch --show-current
Example

Switch branch

Copy it and replace filenames, paths, or keywords as needed.

git switch [branchName]
Example

Create and switch branch

Copy it and replace filenames, paths, or keywords as needed.

git switch -c [newBranch]
Example

Merge branch

Copy it and replace filenames, paths, or keywords as needed.

git merge [branchName]
Example

asp

Retrieve Arch Linux package build files

asp checkout [package]
Details

git-checkout

Switch branches or restore working tree files

git checkout [branch-name]
Details

git-cherry

Find commits not merged upstream

git cherry [upstream] [branch]
Details

git-filter-branch

Rewrite branch history by applying filters

git filter-branch --tree-filter 'rm -f [file]' HEAD
Details

git-graft

Merge a branch and delete it immediately

git graft [feature-branch]
Details

git-guilt

Track authorship changes between commits

git guilt [branch1] [branch2]
Details

git-imerge

Incremental bisect-style merging

git imerge start --name=[merge-name] [branch]
Details

git-merge-base

Find common ancestor commits for a merge

git merge-base [branch1] [branch2]
Details

git-merge-repo

Merge repository into subdirectory

git merge-repo [repo-url] [branch] [directory]
Details

Inspecting History

35 commands

Show commit log

Copy it and replace filenames, paths, or keywords as needed.

git log
Example

Show graph log

Copy it and replace filenames, paths, or keywords as needed.

git log --oneline --graph --all
Example

Show commit details

Copy it and replace filenames, paths, or keywords as needed.

git show [commitHash]
Example

Show changes

Copy it and replace filenames, paths, or keywords as needed.

git diff
Example

argocd

GitOps continuous delivery CLI for Kubernetes

argocd login [argocd.example.com]
Details

codecrafters

hands-on software engineering challenges platform CLI

codecrafters login
Details

cody

Sourcegraph Cody AI coding assistant CLI

cody auth login --web
Details

delta

syntax-highlighting pager for diffs

git diff | delta
Details

diffstat

patch file statistics generator

diffstat [patch.diff]
Details

difft

syntax-aware structural diff tool

difft [old_file] [new_file]
Details

difftastic

Structural diff tool with syntax awareness

difft [file1] [file2]
Details

dolt-blame

show the commit, author, and timestamp that last modified each row of a Dolt table

dolt blame [table_name]
Details

forgit

Interactive git commands with fzf

forgit log
Details

git-apply

Apply patches to files and the index

git apply [patch.diff]
Details

git-blame

Show what revision and author last modified each line

git blame [file.txt]
Details

git-difftool

Compare changes using external visual diff tools

git difftool [file]
Details

Undoing Things

10 commands

Discard file changes

Copy it and replace filenames, paths, or keywords as needed.

git restore [fileName]
Example

Unstage a file

Copy it and replace filenames, paths, or keywords as needed.

git restore --staged [fileName]
Example

Amend last commit

Copy it and replace filenames, paths, or keywords as needed.

git commit --amend
Example

Revert last commit

Copy it and replace filenames, paths, or keywords as needed.

git revert HEAD
Example

git-reset

Reset current HEAD to a specified state

git reset [file]
Details

git-restore

Restore working tree files or unstage changes

git restore [file]
Details

git-rm

Remove files from the working tree and index

git rm [file.txt]
Details

tfjournal

Record Terraform runs with git context and timing

tfjournal -- terraform apply
Details

webstorm

JetBrains JavaScript IDE launcher

webstorm [path/to/project]
Details

Stashing

4 commands

Stash uncommitted work

Copy it and replace filenames, paths, or keywords as needed.

git stash -u
Example

List stashes

Copy it and replace filenames, paths, or keywords as needed.

git stash list
Example

Apply and drop stash

Copy it and replace filenames, paths, or keywords as needed.

git stash pop
Example

git-stash

Temporarily save uncommitted changes for later

git stash
Details

Tags

11 commands

Create tag

Copy it and replace filenames, paths, or keywords as needed.

git tag [tagName]
Example

Create annotated tag

Copy it and replace filenames, paths, or keywords as needed.

git tag -a v1.0 -m "release 1.0"
Example

Push all tags

Copy it and replace filenames, paths, or keywords as needed.

git push --tags
Example

git-rename-tag

Rename a Git tag locally and on the remote

git rename-tag [old_name] [new_name]
Details

kaniko

builds container images from Dockerfiles inside containers or Kubernetes

/kaniko/executor --dockerfile=[Dockerfile] --context=[dir://workspace] --destination=[gcr.io/project/image:tag]
Details

trivy

Comprehensive security vulnerability scanner

trivy image [image_name:tag]
Details

Remotes

11 commands

List remotes

Copy it and replace filenames, paths, or keywords as needed.

git remote -v
Example

Add remote

May affect permissions or system state. Check the target first.

git remote add [remoteName] [remoteURL]
Example

Fetch remote changes

Copy it and replace filenames, paths, or keywords as needed.

git fetch [remoteName]
Example

git-fetch

Download objects and refs from remote repositories

git fetch
Details

git-rscp

Copy files to a remote via rsync

git rscp [remote] [files]
Details

git-scp

Copy files to a remote Git repository via scp

git scp [remote] [path/to/file]
Details

jj-git-fetch

fetches changes from Git remotes into a Jujutsu repository

jj git fetch
Details

onefetch

command-line Git information tool that displays repository summary with ASCII

onefetch
Details

Rewriting History

5 commands

Rebase current branch

Copy it and replace filenames, paths, or keywords as needed.

git rebase [branchName]
Example

Interactive rebase

Copy it and replace filenames, paths, or keywords as needed.

git rebase -i HEAD~3
Example

Cherry-pick a commit

Copy it and replace filenames, paths, or keywords as needed.

git cherry-pick [commitHash]
Example

Getting Help

261 commands

Open help for command

Copy it and replace filenames, paths, or keywords as needed.

git help [command]
Example

ack

grep-like source code search tool for programmers

ack [pattern]
Details

aider

AI pair programming in the terminal

aider [file1.py] [file2.py]
Details

amp

Vi/Vim-inspired terminal text editor

amp [path/to/file]
Details

antigen

Zsh plugin manager inspired by Vundle

antigen use oh-my-zsh
Details

atom

Hackable text editor built on Electron

atom
Details

aurpublish

Publish packages to the Arch User Repository

aurpublish [package_name]
Details

aws-amplify

Build and deploy full-stack web and mobile applications

aws amplify create-app --name [app_name] --repository [repo_url]
Details

az-repos

Manage Azure DevOps Git repositories and pull requests

az repos list --project [MyProject]
Details

bash-it

Framework for managing Bash plugins, aliases, and themes.

bash-it enable plugin [git]
Details

basher

Package manager for shell scripts

basher install [username/repository]
Details

bat

Cat clone with syntax highlighting and Git integration

bat [file.js]
Details

batcat

Debian/Ubuntu name for the bat file viewer

batcat
Details

berks

Dependency manager for Chef cookbooks

berks install
Details

bfg

Remove unwanted data from Git repository history

bfg --delete-files [secrets.txt] [repo.git]
Details

bit

Modern Git CLI wrapper with simplified commands

bit save
Details

bower

Manage front-end web dependencies.

bower install [jquery]
Details

buff

Lint, format, and manage Protocol Buffer files

buf lint [path/to/protos]
Details

bun-patch

Patch installed packages locally

bun patch [package-name]
Details

bun-pm-trust

Manage trusted dependencies in Bun projects

bun pm trust [package1] [package2]
Details