Repository files navigation
git config --global user.name "Your Name"
Set the user's name for all repositories.
git config --global user.email "your.email@example.com"
Set the user's email for all repositories.
git init
Initialize a new Git repository.
git clone <repository-url>
Clone an existing repository.
git branch
git branch <new-branch-name>
git checkout <branch-name>
git checkout -b <new-branch-name>
Create and switch to a new branch.
git status
Check the status of the working directory.
git add <file-or-directory>
Stage changes for commit.
git add .
Stage all changes in the working directory for commit.
git commit -m "Your commit message"
git log
git log --oneline
Show commit history with one-line summaries.
Pushing and Pulling Changes
git push origin <branch-name>
Push changes to a remote repository.
git pull origin <branch-name>
Pull changes from a remote repository.
git merge <branch-name>
Merge a branch into your current branch.
git rebase <branch-name>
Rebase your current branch onto another branch.
git add <file-with-conflict>
Mark conflicts as resolved.
git rebase --continue
Continue rebase after resolving conflicts.
git stash
Stash uncommitted changes.
git stash apply
Collaborating with Remote Repositories
git remote add <remote-name> <repository-url>
git remote -v
List remote repositories.
git fetch <remote-name>
Fetch changes from a remote repository.
git push <remote-name> <branch-name>
Push changes to a remote repository.
git diff
Show differences between working directory and the index.
git diff --cached
Show differences between the index and the last commit.
git tag <tag-name>
git push origin --tags
Push tags to the remote repository.
You can’t perform that action at this time.