Git Commands


Git Command Description
git clone <repo-URL> Create local repository from remote
git pull Update the local repository from the remote repository (e.g., GitHub)
git commit -am "<commit-message>" Commit current changes to the local repository
git push Update remote repository from local repository
git log View commit log
git log --oneline View the commit log with only the commit id and commit message
git add rainfall.cpp Stage commits in the local repository
git commit -m "<commit-message>" Commit staged changes to the local repository
git status View current staged and modified files
git diff View diff of modified files
git diff --cached View diff of staged files
git tag List tags
git tag v1a Create lightweight tag
git tag v1a <commit_id> Create lightweight tag on a previous commit
git push origin v1a Push tag to server
git checkout v1a Checkout a tag
git checkout main Checkout a branch
git tag -d v1a Delete local tag
git push origin --delete v1a Delete remote tag

How to Write a Git Commit Message


Configuraton

The following commands change your configuration. They only need to be performed once.

Git Command Description
git config --global log.date local Set time and date display for git log and other commands to local time