GitCheatSheet
Configure Fork after Clone (setup upstream)
- Open Git Console/Bash
- List the current configured remote repositories for your fork
git remote -v
- Specify a new remote upstream repository that will be synced with the fork
git remote add upstream https://full_path_to_repo/repo.git
- Verify the new upstream repository you've specified for your fork
git remote -v
Every url should listed twice (fetch and push)
Sync your fork with upstream
- Fetch original master
Upstream/Master
- Checkout your fork local master
Local/Master
- Merge
Upstream/Master
toLocal/Master
(Fast Forward) - Push
Local/Master
toOrigin/Master
(This will update remote master in your fork)
Merge
- Checkout your local Feature branch
Local/Feature
- Merge
Local/Master
to your Feature branch - Resolve conflicts
- Build
- Push
Local/Feature
toOrigin/Feature
Diff a feature branch with your form master branch (rebase alternative)
- Open Git Console/Bash
- Create patchfile
git diff master...Feature-Branch > diff.patch
- Create a new branch from master (Feature-Clean) and apply your patch to the new branch
git apply diff.patch
GitHub UI Hints & Tricks
- Add .patch postix to PR to get a diff file
e.g.,https://github.com/repo/pull/123
->https://github.com/repo/pull/123.patch