-
Notifications
You must be signed in to change notification settings - Fork 65
Git Commands
Cameron Smith edited this page Aug 23, 2016
·
8 revisions
This page lists common Git commands that SCOREC developers have used. Please review our Git Theory page to help gain an understanding of how Git works before reading this page.
| Command | Description |
|---|---|
git help |
View summary of common commands |
git help commit |
View documentation about the git commit command |
git init |
Create a new Git repository with the current directory as the source directory |
git clone https://github.com/SCOREC/core.git pumi |
Clone a remote repository, creating source directory pumi
|
git status |
Display a variety of current status info. When in doubt, run this. |
git log |
Show history in a linear fashion with full commit metadata |
git log --oneline --graph --all --decorate |
Show the history graph including where branches point to |
git show abcd123 |
Show all the information about commit abcd123, including what changes it made |
git add myfile.cpp |
Accept all changes to myfile.cpp into the index. If untracked, start tracking. |
git add --patch myfile.cpp |
Interactively accept some changes into the index. |
git add -u |
Accept all modifications and removals of tracked files into the index. |
git add -A |
Like git add -u, also start tracking all untracked files. |
git commit |
Create a commit from the index, opens environment variable $EDITOR to write commit message |
git commit -m 'Renamed a function' |
Specify the commit message on the command line |
git commit -a |
Same as git add -u followed by git commit
|
git diff |
Show changes between the index and the source directory |
git diff --cached |
Show changes between the index and HEAD
|
git diff --stat |
Summarize differences as number of lines changed |
git cherry-pick abcd123 |
Copy commit abcd123 to the current branch |