Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Minimal git commands
## Happy path
# Create a new branch to put your code on
git checkout -b my-new-branch
# Add all your changed files to a commit (will not start tracking new files)
git commit -am "description of my new changes"
# Push your new branch to github. Then go to github to make a PR
git push -u origin my-new-branch
# Sometime after your changes are merged in you'll go back to the master branch and git the updates from github
git checkout master && git pull
## Helpful commands
# See what you have changed
# This will tell you what branch you're on, what's changed, what's added/staged but not
# actually committed yet, what's untracked
git status
# If you have new files you want to start tracking or want to add files individually
git add --all
# or
git add some/new/file.txt some/new/directory
# You don't have to add and commit all at once you can add in other commands and commit when you are ready
git commit -m "some message"
# Push updates to a branch that's already on github
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment