-
Notifications
You must be signed in to change notification settings - Fork 23
Github Workflow Cheat Sheet
Hackalog edited this page Mar 16, 2020
·
8 revisions
Here are some common tasks in git/github
git branch # What branch am I currently on? e.g. {my_branch}
git status # anything I forgot to commit? If so...
git commit ... # Commit work in progress
git checkout master # leave whatever branch I was on
git fetch origin --prune # Check for something new
git merge origin/master # If updates available, update!
git checkout master
git fetch upstream --prune # grab latest changes from upstream repo
git merge upstream/master # merge them into local copy of my form
git push origin master # push latest upstream changes to my forked repo
git branch --merged master # check for any merged branches that can be safely deleted
git branch -d {name_of_merged_branch} # delete any fully merged branches
Now that master is up to date, you should merge whatever happened in master into your development branch:
git checkout {my_branch}
git merge master # merges master->{my_branch}
git push origin {my_branch} # Let Github know about the merge
- Always work on a branch:
git checkout -b my_branch_name - Never push to
master. Always work on a branch and do a pull request. - Seriously, don't do work on
master. - If you pushed it anywhere, don't
git rebase. In fact, if you're reading this, don'tgit rebase.