Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

CommandDescription
git clone <link> 

Creates a copy of a repository from a specified link and downloads it to the local machine.

git pull 

Fetches changes from a remote repository and merges them into the current branch.

git add <file> 

Stages specific files or folders in the working directory for the next commit.

git add -A 

Stages all changes, including untracked files and deletions, in the working directory for the next commit.

git add . 

Stages all changes in the current directory for the next commit.

git commit 

Records changes in the staged area, creating a new commit. Opens the default text editor for the user to specify a commit message.

git commit -m "<message>" 

Records changes in the staged area, creating a new commit with a commit message specified in the command itself.

git push 

Pushes local commits to a remote repository, updating the remote branch with the latest changes.

git restore --staged <file> 

Unstages changes for a specific file, reverting them from the staging area.

git restore <file> 

Discards changes in the working directory for a specific file, reverting it to the state of the last commit.

git status 

Displays the status of changes as untracked, modified, or staged in the working directory.

git branch 

Lists all local branches and highlights the currently active branch.

git branch -a 

Lists all branches including remote branches.

git branch <branch-name> 

Creates a new branch with the specified name.

git checkout <branch-name> 

Switches between branches or restores working tree files.

git checkout -b <branch-name> 

Creates a new branch and switches to it in a single command.

git merge <branch-name> 

Merges changes from a specified branch into the current branch.

git diff 

Shows the differences between the working directory and the staging area.

git diff --cached 

Displays the differences between the staging area and the last commit.

git fetch 

Fetches changes from a remote repository without merging them into the local branches.

git log 

Displays the commit history, showing details like commit messages, authors, and timestamps.

git log --oneline 

Displays a simplified one-line commit history, showing abbreviated commit hashes and commit messages.

git stash 

Temporarily saves changes that are not ready to be committed, allowing you to switch branches or perform other tasks.

git stash list 

Shows a list of stashed changes, including stash IDs and descriptions.

git stash pop 

Applies the latest stash and removes it from the stash list.

...