2019-11-05: usethis::pr_sync( )

Before merging your pull request, the source repository adds a conflicting commit. Now what?

"pr_sync( ) is a shortcut for pr_pull( ), pr_pull_upstream( ), and pr_push( )" (usethis)

https://twitter.com/mauro_lepore

License: CCO

create_from_github()

# Fork on GitHub, then run from a terminal:
git clone git@github.com:maurolepore/abc.git
cd abc

# Contrib@LAPTOP ~/abc (master)
git remote add upstream git@github.com:an-org/abc.git
git pull upstream master
git branch --set-upstream-to=upstream/master

git_sitrep()

git remote -v

pr_init("pr")

# Contrib@LAPTOP ~/abc (master)
git pull upstream master
git branch pr
git checkout pr

pr_push()

# Contrib@LAPTOP ~/abc (pr)
git push origin
git branch --set-upstream-to=origin/pr

https://github.com/maurolepore/abc/compare/pr

But before [pr] is merged, the maintainer adds a conflicting change to the source repository

pr_sync()

# Contrib@LAPTOP ~/abc (pr)
# Using default remote "origin" and branch "pr"
# `git pull` is shorthand for `git fetch && git merge FETCH_HEAD`
git pull
git pull upstream master
git push

Solve merge conflicts

pr_push()

# Contrib@LAPTOP ~/abc (pr)
# Retry sync
git pull
git pull upstream master
git push

[pr] now has no conflicts with [upstream/master]

pr_finish()

# Contrib@LAPTOP ~/abc (pr)
git checkout master

# Contrib@LAPTOP ~/abc (master)
git pull upstream master
git push -d origin pr
git branch -d pr


2DegreesInvesting/ds-incubator documentation built on Oct. 13, 2021, 10:09 a.m.