Updates the index using the current content found in the working tree.
git add -A: Stages all files in the working tree.
git add .: Stages new and modified files in the working tree, excluding deleted files (ignores actions that remove files).
git add -u: Stages modified and deleted files in the working tree, excluding new files (ignores actions that add files).
Lists, creates, or deletes branches.
git branch --list: Lists existing branches, highlighting the current branch with an asterisk.
git branch -a: Displays all local and remote branches.
git branch -r: Displays all remote branches.
git branch -m old-branch new-branch: Changes the name of the existing
git branch -d branch-name: Deletes
Moves from the current branch to the specified branch.
git checkout -b new-branch-name: Creates a new branch named
new-branch-name and makes it the current active branch.
git checkout branch-name: Moves onto
git checkout master: Moves onto the
git checkout -- file.md: Discards changes made to
file.md since beginning work with the current directory.
Cleans the working tree by removing untracked files.
git clean -fd: Removes untracked directories and untracked files from the current branch.
Stores the current content of the index in a new commit. A message must be added describing the commit using the syntax
git commit -m "message", with the message string wrapped in quotes.
git commit -m "message here": Identifies a commit message to follow (in quotes).
Shows the commit log for the working tree, including the commit ID and message.
Merges the specified branch with the current branch.
git merge recent-branch: Merges
recent-branch with the current branch, like
Fetches from a remote repository and integrates changes into the current branch.
git pull origin master: Fetches and merges changes from the
origin repository into the local
Pushes changes in the specified branch to the specified remote repository.
git push origin recent-branch: Pushes the local version of
git push origin master: Pushes the
master branch to the
origin remote repository and checks out the
Manages a set of tracked repositories.
git remote add name url: Adds a remote named
name for the repository located at
git remote -v: Displays a list of all configured remote urls.
Resets the current HEAD to the specified state.
git reset --hard some-commit: Points the current branch to
some-commit and exchanges the local working directory files and the index with versions of those committed in
Displays the working tree status, showing paths that have differences between the index–staging area–and the current HEAD commit, paths that have differences between the working tree and index, and paths in the working tree that are not being tracked.