Git: Difference between revisions
No edit summary |
No edit summary |
||
Line 7: | Line 7: | ||
Discard ALL LOCAL COMMITS and get the (possibly diverged) remote instead | Discard ALL LOCAL COMMITS and get the (possibly diverged) remote instead | ||
git reset --hard origin/master | git reset --hard origin/master | ||
|} | |||
{| class="mw-collapsible mw-collapsed wikitable" | |||
! getting upstream commits into your GitHub fork | |||
|- | |||
| From [http://stackoverflow.com/a/7244456/717274 so...] | |||
Add the remote, call it "upstream": | |||
git remote add someauthor-upstream https://github.com/someauthor/theprojectiforked.git | |||
Fetch all the branches of that remote into remote-tracking branches, such as upstream/master: | |||
git fetch someauthor-upstream | |||
Get on the branch where you are tracking the rebase. Typically your master branch but can be whatever: | |||
git checkout tlsv12 # or master or... | |||
Rewrite your branch so that any commits of yours that aren't already in upstream are replayed on top of that other branch (if you do a straight merge instead of rebase you'll screw up the upstream!): | |||
git rebase someauthor-upstream/master | |||
IF the branch that was the target of the rebase existed, force the push in order to push it to your own forked repository on GitHub. You only need to use the -f the first time after you've rebased: | |||
git push -f origin master | |||
ELSE if the branch you merged into is a new creation, set its upstream when you push: | |||
git push --set-upstream origin tlsv12 | |||
|} | |} | ||
{| class="mw-collapsible mw-collapsed wikitable" | {| class="mw-collapsible mw-collapsed wikitable" |
Revision as of 11:57, 21 August 2016
TASKS
Expandgit merging conflicts after diverging |
---|
Expandgetting upstream commits into your GitHub fork |
---|
Expandgit create new branch on server, pull to client |
---|
Expandgit pull when untracked files are in the way |
---|
Expandgit create new branch when untracked files are in the way |
---|
Expandgit recreate repo |
---|
Expandgit connect to origin after the fact |
---|
CONFIGURATION
Expandgit visual difftool and mergetool setup |
---|
Expandgit convert to a bare repo |
---|
Expandgit convert bare to a mirror of remote (github, facebook, etc) |
---|
Expandgit create merge-to command |
---|
Expandgit fix github diverge from local bare repo following README.md edit |
---|
Expandgit windows configure notepad++ editor |
---|
Expandgit fix push behavior - ONLY PUSH CURRENT doh |
---|
Expandgit multiple upstreams |
---|
From here...