Skip to main content

GIT Commands and Basic Git Workflow

hashcomics😋
1 / 5
Panel 1
Panel 1
Panel 2
Panel 3
Panel 4
Panel 5

git Commands

CommandDescription
git initInitialize a new Git repository
git clone <url>Clone an existing remote repository
git statusCheck the current state of the repository
git add <file>Stage a file for the next commit
git add .Stage all changes
git commit -m "message"Create a commit
git log --onelineView compact commit history
git diffView unstaged changes
git diff --stagedView staged changes
git branchList branches
git switch <branch>Switch branches
git switch -c <name>Create and switch to a new branch
git merge <branch>Merge a branch into the current branch
git rebase <branch>Reapply commits on top of another branch
git stashTemporarily save uncommitted changes
git stash popRestore stashed changes
git restore <file>Discard unstaged changes
git restore --staged <file>Unstage a file
git reset <commit>Move HEAD to another commit
git revert <commit>Create a new commit that undoes a previous commit
git remote -vView configured remote repositories
git fetchDownload changes from a remote without merging
git pullFetch and integrate changes from a remote
git pushUpload local commits to a remote
git tag <name>Create a tag for a commit
git config --global user.name "<name>"Set your global Git username
git config --global user.email "<email>"Set your global Git email
git config user.name "<name>"Set username for the current repository
git config user.email "<email>"Set email for the current repository