MORE DETAILED REFERENCE:
Update my local master
branch to the upstream/master
(NOTE: This assumes you already have a remote called upstream
linked to your group project)
git fetch --all
git branch // MAKE SURE YOU ARE ON THE MASTER BRANCH
git reset --hard upstream/master // now your local master branch is set to the upstream/master, yay!
git checkout your_branch // now check out your branch
do you need to squash?
if you have more than one commit on your branch then squash/fixup first
git log // check how many commits you have on your branch
git rebase -i HEAD~2 // this will include the last 2 commits in your rebase
// choose a diff # if you need to
pick
or s
or f
the commits
pick
will keep the message, s
will squash it, f
will fixup
if you choose s
then you will be given a second window after you save where you can choose or edit the message you want to keep
if you choose f
then your commit message will be the same as the commit you pick
git log // check that the commits squashed/fixed up the way that you anticipated
now time to rebase to make sure your branch doesn't have any conflicts with the main project branch (upstream/master)
git rebase master // remember when we set your master branch to the upstream/master?
// now we are rebasing your branch with master (ie, upstream/master)
if the rebase shows any conflicts, look at those files and resolve the conflicts,
(ie, choose which version of the code should stay and delete the rest - make sure you don't delete other people's work though!)
if you aren't sure if you are still in a rebase, or sometimes it is just good to check, you can use these commands to help you out:
git rebase --continue // maybe you were given a message to resolve conflicts, use this after you're done.
// this command will tell you what you need to do to continue successfully rebasing
// or it will tell you that no rebase is in progress. peace of mind either way.
git rebase --abort // maybe you aren't sure what happened and you are worried ... you can use this and start again
are you all up to date? push it up!
git push origin your_branch // this is the first time you are pushing up your code
OR
git push origin your_branch -f // if you already have a pull request up, you need to force push (-f)
// to replace what is up in GitHub with your current work on your_branch