Node: Question about backporting

Created on 21 Jun 2017  路  9Comments  路  Source: nodejs/node

According to the guide, I launch:

git branch v6.x-staging upstream/v6.x-staging
git checkout v6.x-staging
git reset --hard upstream/v6.x-staging

and get this:

HEAD is now at b483675300 test,doc: document `crashOnUnhandledRejection()`

while the last commit here is test: dynamic port in cluster disconnect. Also, my local file tree is older than one I see here.

What do I miss?

meta

Most helpful comment

Yes git fetch upstream v6.x-staging:v6.x-staging -f
if git remote upstream is nodejs/node, that command will create local v6.x-staging based on upstream/v6.x-staging and -f will overwrite any old v6.x-staging you might have had.

Then you git checkout -b backport-XXXX-to-v6.x v6.x-staging that will make a new (-b) branch backport-XXXX-to-v6.x based on your newly fetched v6.x-staging

All 9 comments

Did you try to git pull in changes from remote/upstream?

@mscdex No. Should I? The guide says nothing about git pull. And I've previously deleted all the staging local branches and have run git branch v6.x-staging upstream/v6.x-staging after the test: dynamic port in cluster disconnect landed on upstream/v6.x-staging.

I've open a PR to update the guide (after similar experience) https://github.com/nodejs/node/pull/13749

@refack So, assuming I have no local staging branch, how should I proceed to create a new updated one from upstream/v6.x-staging? Is it git fetch upstream v6.x-staging:v6.x-staging -f as in your PR?

Yes git fetch upstream v6.x-staging:v6.x-staging -f
if git remote upstream is nodejs/node, that command will create local v6.x-staging based on upstream/v6.x-staging and -f will overwrite any old v6.x-staging you might have had.

Then you git checkout -b backport-XXXX-to-v6.x v6.x-staging that will make a new (-b) branch backport-XXXX-to-v6.x based on your newly fetched v6.x-staging

What @refack says is true, but the more common workflow when you're doing anything with git is:

git fetch --all # Update all your remote branches
git checkout v6.x-staging
git status # If "up to date" then you're done
git merge --ff-only # If you're "x commits behind"
git reset --hard up/v6.x-staging #  If "your branch has diverged from the upstream"

Git aliases are quite helpful for this, I do:

g fa
g co v6.x-staging
g s
g mf
g rhh

I recommend avoiding git pull unless you've set pull.rebase = true.

I'm special kind of tweaker, so git fetch --all doesn't work for me (since I removed the fetch +=* from .git/config because there are too many branches).
git fetch OR pull upstream v6.x-staging:v6.x-staging -f does the merge and reset steps in one (but discards any local changes to v6.x-staging which if you are not @gibfahn you should not have).

I'm special kind of tweaker,

I thought that was just because git fetch --all takes ages on Windows (it's about 3s on my machine, and I have 3 remotes).

I thought that was just because git fetch --all takes ages on Windows (it's about 3s on my machine).

Not so bad for my fork, nodejs/node takes ~10-15 seconds (which I assume is a GitHub bug, since they are clones 馃槙 )

P.S. the problem is how the tree looks in the GUI (and that's with "compressed graph")
image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

akdor1154 picture akdor1154  路  3Comments

dfahlander picture dfahlander  路  3Comments

vsemozhetbyt picture vsemozhetbyt  路  3Comments

sandeepks1 picture sandeepks1  路  3Comments

jmichae3 picture jmichae3  路  3Comments