Last active
August 29, 2015 14:25
-
-
Save coopermaruyama/1372aee5bfcbb92f3e8f to your computer and use it in GitHub Desktop.
Git Notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --------------------------------------------------- | |
# Correct workflow when working with forked upstreams. | |
# --------------------------------------------------- | |
git fetch origin --prune | |
# If you haven't made any local changes: | |
git checkout branch-name | |
git merge --ff-only origin/branch-name | |
# If you have local changes, you'll get this error: fatal: Not possible to fast-forward, aborting. | |
# Rebase, but without creating an additional commit per merge. | |
git rebase --preserve-merges origin/branch-name | |
# ---------------------------------- | |
# Using subtree instead of submodules | |
# ----------------------------------- | |
# - When committing, separate subtree-related commits from your main repo commits (not required but ideal). | |
# add the remote | |
git remote add -f cool-plugin-remote https://github.com/user/some-plugin.git | |
# pull, suqashing the entire history | |
git subtree add --prefix vendor/cool-plugin cool-plugin-remotr master --squash | |
# At a later date, pull in new changes | |
git fetch cool-plugin master | |
git subtree pull --prefix vendor/cool-plugin cool-plugin-remote master --squash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment