diff --git a/Typical-Git-Workflow.md b/Typical-Git-Workflow.md new file mode 100644 index 0000000..d623c39 --- /dev/null +++ b/Typical-Git-Workflow.md @@ -0,0 +1,54 @@ +## Git Typical Workflow + +**Terminology** +* `upstream`: Main project repo +* `origin`: Forked project repo + +**Before you begin** +* Fork the project on GitHub +* Clone your fork locally + * `git clone https://github.com/your-username/citra.git' + +**Create a new branch** +* Update `local/master` with `upstream/master` (if it's not a brand new fork) + * `git checkout master` + * `git pull upstream/master` +* Update origin/master with `upstream/master` if you’d like + * `git push origin/master` +* Create your branch from the latest master + * `git checkout -b new-branch-name` +* Push your new branch to origin if you'd like + * `git push origin new-branch-name` + +**Scenario A: You did some work in your branch… Then, someone committed something to master that you want!** +* Make sure you're on your branch + * `git checkout new-branch-name` +* Rebase upstream/master onto it. With the rebase, move all of your changes to the top, and put all of the new master changes immediately after where you branched from. The goal should be that the branch now appears as though you just created it, and then committed all of your new stuff. + * `git rebase -i upstream/master` +* Resolve any conflicts, then update `origin/new-branch-name` if you'd like + * `git push origin/new-branch-name --force` + +**Scenario B: You did some more work in your branch... Then, someone committed something to `upstream/master` that conflicts with something you've been working on!** +* Repeat the previous step (interactive rebase `upstream/master` to your branch) +* Resolve any conflicts, then update `origin/new-branch-name` if you'd like + * `git push origin/new-branch-name --force` + +**Your branch is getting near completion, now you're ready for a pull request!** +* Repeat the previous step (interactive rebase `upstream/master` to your branch) +* Resolve any conflicts, then update origin/new-branch-name + * `git push origin/new-branch-name --force` +* Create the pull request on GitHub to merge `origin/new-branch-name` into `upstream/master` + +**Gracefully receive feedback from the team** +* Address each comment with a commit as needed + +**Once your pull request is ready to be merged...** +* From your branch, interactive rebase to squash all of the new commits (as a result of the pull request feedback) into the commits that they were addressing + * `git checkout new-branch-name` + * `git rebase -i HEAD~n` +* Repeat the previous step (interactive rebase `upstream/master` to your branch) +* Resolve any conflicts, then update origin/new-branch-name + * `git push origin/new-branch-name --force` +* Merge your branch in + * Always merge to `upstream/master` using GitHub + * If there are conflicts, you're doing it wrong :( Go back and try again. \ No newline at end of file