Git commands
Some tooltip text!
• 2 minutes to read
• 2 minutes to read
Here we are using the Git Bash command line.
Note
Paths are relative to your current directory
Get the latest updates from GitHub
git pull
Unless you are working on your fork, make it a habit to pull:
- before you start every morning
- frequent during the day
- before you start a commit
Resolve any merge conflicts.
Check local changes
git status
Checking status "all the time"? Create a convenient shorthand:
git config --global alias.st status
The next time you can just type git st
. (Don't worry, git status
will still work.)
Inspect commit log
git log
Saving changes to your repository
Tell Git what you want to save.
- Everything:
git add --all
or
git add .
- A specific folder (recursive):
git add docs/onsite
- A specific file:
git add docs/index.md
Note
If you have moved or renamed a file without using
git mv
, you must add both the old and the new file or folder name!Commit your saved changes to your local repository.
git commit -m "#[ISSUE ID] Short description of changes"
Send your changes to GitHub.
git push
- If you didn't set the upstream when you created the branch, you need to do it now:
git push --set-upstream origin <branchname>
You've done it! Your code is now up in your GitHub repository!
Tip
Need to fix something you submitted? No problem! Just make your changes in the same branch and then commit and push again.