Git Command
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
GitHub Training Kit: Open source courseware from the GitHub Professional Services team.
Git Downloads
Basic setup
Username
Sets your Git username.
1
git config --global user.name "Your Name"
Sets your Git email address.
1
git config --global user.email "youremail@example.com"
Initialize
Initializes a new Git repository in your current directory.
1
git init
Clone
Clones an existing repository to your local machine.
1
git clone <repository_URL>
Status
Shows the status of your working directory and staging area.
1
git status
Working with Changes
Staging Changes
Stages a specific file for a commit.
1
git add <file>
Stages all changes in the current directory.
1
git add .
Commit Changes
Commits staged changes with a message.
1
git commit -m "Your commit message"
Modifies the last commit (useful for fixing commit messages or adding files).
1
git commit --amend
Syncing
Set Repository
Set up a remote repository.
1
git remote add origin <repository_URL>
Fetch
Download changes from a remote repository without merging them.
1
git fetch
Pull
Fetch and integrate changes from a remote repository into your current branch.
1
git pull
Push
1
git push