-
Notifications
You must be signed in to change notification settings - Fork 24
Git Overview
-
Show git commands
git
-
Execute command
git <command>
-
Help on a command
git help <command>
-
Built-in tutorial
git help tutorial
-
Clone a remote repository
git clone https://<username>@<hostname>/path/to/repository
git clone similar to svn checkout
-
Add changes to the Index (staging area on local repository)
git add <filename>
Use for both modified and new files -
Commit changes on local repository
git commit -m "Commit message"
-
Push to master branch on remote repository
git push origin master
git add, commit, push combination similar to svn commit
-
Pull from master branch on remote repository
git pull origin master
git pull similar to svn update
-
Rename or remove files with
git mv
orgit rm
git clone https://github.com/NCAR/MET
Will create the directory MET and the project subdirectories in your current working directory
cd MET/src/tools/core/point_stat
Edit point_stat.cc
git add point_stat.cc
git commit -m "Made changes to point_stat.cc."
git push origin master
-
Switch to a branch on local repository
git checkout <branch>
-
Create a new branch on local repository
git branch <branch>
or create and switch to new branch
git checkout -b <branch>
-
Push branch to remote repository
git push origin <branch>
-
Merge develop to branch
git checkout develop
git pull
git checkout <branch>
git merge develop
git push
-
Merge branch to master
git checkout master
git merge <branch>
git push origin master
-
Fetch new branches and tags from remote repository
git fetch origin
-
Pull updates from branch on remote repository
git pull origin <branch>
-
Show branches and current branch
git branch
-
Branch history
git log
-
Branch differences with master
git diff master <branch>