Create local repository from remote with default directory | git clone https://github.com/UACPSC/OOPS24-Rainfall-010.git |
Create local repository from remote with named directory | git clone https://github.com/UACPSC/OOPS24-Rainfall-010.git Rainfall |
Update local repository from remote repository (e.g., GitHub) | git pull |
Edit files locally, e.g., add a header comment to the file rainfall.cpp | |
Commit current changes to the local repository | git commit -am "Add a header comment" |
Update remote repository from local repository | git push |
View commit log | git log |
Update local repository from remote repository (e.g., GitHub) | git pull |
Edit files locally, e.g., add a header comment to the file rainfall.cpp | |
Stage commits in the local repository | git add rainfall.cpp |
Commit staged changes to the local repository | git commit -m "Add a header comment" |
View current staged and modified files | git status |
View diff of modified files | git diff |
View diff of staged files | git diff --staged |
Update remote repository from local repository | git push |
git pull
once per session (but no harm in doing so multiple times)git push
, e.g., if you are offlineAction | Command | Notes |
---|---|---|
List tags | git tag |
List all tags |
Create annotated tag | git tag -a v1a -m "Completed v1a" |
The -a flag creates an annotated tag, and -m supplies the tag message |
Push tag to remote | git push origin v1a |
Push only the tag named v1a to the remote named origin |
Checkout a tag | git checkout v1a |
Check out the commit pointed to by v1a |
Delete local tag | git tag -d v1a |
Delete the tag only in your local repo |
Delete remote tag | git push origin --delete v1a |
Remove the tag v1a from the remote origin |