Comments (7)
Oh, this is a bug. Run the resubmit after rebase with ghstack --no-skip
. The commit "looks too similar" to what is pushed to master and so ghstack thinks no update is necessary when it should.
from ghstack.
it should work, just pass ghstack land PR_URL
where PR_URL is the middle PR of the stack you want to land. It will land everything before that PR and that PR, but nothing after.
from ghstack.
That much works for me, but I'm not sure how to work with the remaining
commits. Even if I rebase them and resubmit them, they don't seem to want
to land afterward. I'm probably missing something:
$ git status
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
$ ls
README a b c
$ echo a >> a
$ git commit -am a
[main 9d12a31] a
1 file changed, 1 insertion(+)
$ echo b >> b
$ git commit -am b
[main 3ef98da] b
1 file changed, 1 insertion(+)
$ echo c >> c
$ git commit -am c
[main 202aeb6] c
1 file changed, 1 insertion(+)
$ ghstack
$ git remote get-url origin
$ git fetch origin
$ git merge-base origin/main HEAD
$ git rev-list --header ^434a2cc1abc218f01b20e9ae7aa9a57f8ceb1538 HEAD
$ git rev-list --header ^434a2cc1abc218f01b20e9ae7aa9a57f8ceb1538^@
434a2cc1abc218f01b20e9ae7aa9a57f8ceb1538
$ git for-each-ref refs/remotes/origin/gh/yang --format=%(refname)
$ git rev-parse 9d12a319d89721df5b124fbaa743830805ee80c8~^{tree}
$ git commit-tree 34f08e107e9507736975d5fdd6ab3221b844d8d4 -p
434a2cc1abc218f01b20e9ae7aa9a57f8ceb1538
$ git push origin
658d6d0ef803a5f27cb6ba0272824114909526e5:refs/heads/gh/yang/8/head
434a2cc1abc218f01b20e9ae7aa9a57f8ceb1538:refs/heads/gh/yang/8/base
To github.com:yang/stacktest.git
* [new branch] 658d6d0ef803a5f27cb6ba0272824114909526e5 ->
gh/yang/8/head
* [new branch] 434a2cc1abc218f01b20e9ae7aa9a57f8ceb1538 ->
gh/yang/8/base
Opened PR #9
$ git commit-tree 34f08e107e9507736975d5fdd6ab3221b844d8d4 -p
434a2cc1abc218f01b20e9ae7aa9a57f8ceb1538
$ git for-each-ref refs/remotes/origin/gh/yang --format=%(refname)
$ git rev-parse 3ef98da793e101f5bf1ed393a48895a243c879d2~^{tree}
$ git commit-tree 67c70e2e24f4e2664f3607e96a8947851fc0023c -p
658d6d0ef803a5f27cb6ba0272824114909526e5
$ git push origin
db7aff01297bc4423e9cc3a4f497a9b7b439f3b1:refs/heads/gh/yang/9/head
658d6d0ef803a5f27cb6ba0272824114909526e5:refs/heads/gh/yang/9/base
To github.com:yang/stacktest.git
* [new branch] db7aff01297bc4423e9cc3a4f497a9b7b439f3b1 ->
gh/yang/9/head
* [new branch] 658d6d0ef803a5f27cb6ba0272824114909526e5 ->
gh/yang/9/base
Opened PR #10
$ git commit-tree 67c70e2e24f4e2664f3607e96a8947851fc0023c -p
004237c8c836960582767fc5fdfea0d896e9b298
$ git for-each-ref refs/remotes/origin/gh/yang --format=%(refname)
$ git rev-parse 202aeb679481de15c92e42efbc925a54652d723f~^{tree}
$ git commit-tree b75f6118826a8d6f1dfa480aa465f4793a3e530a -p
db7aff01297bc4423e9cc3a4f497a9b7b439f3b1
$ git push origin
a0f73bb8a4cb216629f511bd630c8e5792d1cf94:refs/heads/gh/yang/10/head
db7aff01297bc4423e9cc3a4f497a9b7b439f3b1:refs/heads/gh/yang/10/base
To github.com:yang/stacktest.git
* [new branch] a0f73bb8a4cb216629f511bd630c8e5792d1cf94 ->
gh/yang/10/head
* [new branch] db7aff01297bc4423e9cc3a4f497a9b7b439f3b1 ->
gh/yang/10/base
Opened PR #11
$ git commit-tree b75f6118826a8d6f1dfa480aa465f4793a3e530a -p
e1607938fc796e1ab07765bbc446b3fb5987d50d
$ git reset --soft 2e33ca396fda250d7311ea18183306f6b9e4b808
# Updating https://github.com/yang/stacktest/pull/9
# Updating https://github.com/yang/stacktest/pull/10
# Updating https://github.com/yang/stacktest/pull/11
$ git push origin --force
004237c8c836960582767fc5fdfea0d896e9b298:refs/heads/gh/yang/8/orig
e1607938fc796e1ab07765bbc446b3fb5987d50d:refs/heads/gh/yang/9/orig
2e33ca396fda250d7311ea18183306f6b9e4b808:refs/heads/gh/yang/10/orig
To github.com:yang/stacktest.git
* [new branch] 004237c8c836960582767fc5fdfea0d896e9b298 ->
gh/yang/8/orig
* [new branch] e1607938fc796e1ab07765bbc446b3fb5987d50d ->
gh/yang/9/orig
* [new branch] 2e33ca396fda250d7311ea18183306f6b9e4b808 ->
gh/yang/10/orig
# Summary of changes (ghstack 0.3.1)
- Created https://github.com/yang/stacktest/pull/11
- Created https://github.com/yang/stacktest/pull/10
- Created https://github.com/yang/stacktest/pull/9
Facebook employees can import your changes by running
(on a Facebook machine):
ghimport -s https://github.com/yang/stacktest/pull/11
If you want to work on this diff stack on another machine:
ghstack checkout https://github.com/yang/stacktest/pull/11
$ ghstack land https://github.com/yang/stacktest/pull/10
$ git fetch origin
$ git merge-base origin/main origin/gh/yang/9/orig
$ git rev-list --reverse --header ^434a2cc1abc218f01b20e9ae7aa9a57f8ceb1538
origin/gh/yang/9/orig
$ git symbolic-ref --short HEAD
$ git checkout origin/main
Note: switching to 'origin/main'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at 434a2cc bb
$ git cherry-pick origin/gh/yang/8/orig
$ git cherry-pick origin/gh/yang/9/orig
$ git push origin HEAD:refs/heads/main
To github.com:yang/stacktest.git
434a2cc..ca8b10f HEAD -> main
$ git checkout main
Previous HEAD position was ca8b10f b
Switched to branch 'main'
$ git status
On branch main
Your branch and 'origin/main' have diverged,
and have 3 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
nothing to commit, working tree clean
$ # First I try to directly merge the last commit c without
rebasing/resubmitting.
$ ghstack land https://github.com/yang/stacktest/pull/11
$ git fetch origin
$ git merge-base origin/main origin/gh/yang/10/orig
$ git rev-list --reverse --header ^434a2cc1abc218f01b20e9ae7aa9a57f8ceb1538
origin/gh/yang/10/orig
$ git symbolic-ref --short HEAD
$ git checkout origin/main
Note: switching to 'origin/main'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at ca8b10f b
$ git cherry-pick origin/gh/yang/8/orig
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:
git commit --allow-empty
Otherwise, please use 'git cherry-pick --skip'
$ git cherry-pick --abort
$ git checkout main
Previous HEAD position was ca8b10f b
Switched to branch 'main'
ERROR: Fatal exception
Traceback (most recent call last):
File
"/Users/yang/.virtualenvs/wab/lib/python3.8/site-packages/ghstack/logging.py",
line 108, in manager
yield
File
"/Users/yang/.virtualenvs/wab/lib/python3.8/site-packages/ghstack/__main__.py",
line 129, in main
ghstack.land.main(
File
"/Users/yang/.virtualenvs/wab/lib/python3.8/site-packages/ghstack/land.py",
line 88, in main
sh.git("cherry-pick", remote_name + "/" + sref)
File
"/Users/yang/.virtualenvs/wab/lib/python3.8/site-packages/ghstack/shell.py",
line 272, in git
return self._maybe_rstrip(self.sh(*(("git",) + args), **kwargs))
File
"/Users/yang/.virtualenvs/wab/lib/python3.8/site-packages/ghstack/shell.py",
line 211, in sh
raise RuntimeError(
RuntimeError: git cherry-pick origin/gh/yang/8/orig failed with exit code 1
$ # Now I try to resubmit first without rebasing.
$ git status
On branch main
Your branch and 'origin/main' have diverged,
and have 3 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
nothing to commit, working tree clean
$ ghstack
$ git remote get-url origin
$ git fetch origin
$ git merge-base origin/main HEAD
$ git rev-list --header ^434a2cc1abc218f01b20e9ae7aa9a57f8ceb1538 HEAD
$ git rev-list --header ^434a2cc1abc218f01b20e9ae7aa9a57f8ceb1538^@
434a2cc1abc218f01b20e9ae7aa9a57f8ceb1538
$ git rev-list --max-count=1 --header origin/gh/yang/8/orig
$ git rev-parse origin/gh/yang/8/head
$ git rev-parse origin/gh/yang/8/orig
$ git rev-parse 004237c8c836960582767fc5fdfea0d896e9b298^{tree}
$ git rev-list --max-count=1 --header origin/gh/yang/9/orig
$ git rev-parse origin/gh/yang/9/head
$ git rev-parse origin/gh/yang/9/orig
$ git rev-parse e1607938fc796e1ab07765bbc446b3fb5987d50d^{tree}
$ git rev-list --max-count=1 --header origin/gh/yang/10/orig
$ git rev-parse origin/gh/yang/10/head
$ git rev-parse origin/gh/yang/10/orig
$ git rev-parse 2e33ca396fda250d7311ea18183306f6b9e4b808^{tree}
$ git reset --soft 2e33ca396fda250d7311ea18183306f6b9e4b808
# Skipping closed https://github.com/yang/stacktest/pull/9
# Skipping closed https://github.com/yang/stacktest/pull/10
# Updating https://github.com/yang/stacktest/pull/11
# Summary of changes (ghstack 0.3.1)
- Skipped https://github.com/yang/stacktest/pull/11
- Skipped https://github.com/yang/stacktest/pull/10
- Skipped https://github.com/yang/stacktest/pull/9
Facebook employees can import your changes by running
(on a Facebook machine):
ghimport -s https://github.com/yang/stacktest/pull/11
If you want to work on this diff stack on another machine:
ghstack checkout https://github.com/yang/stacktest/pull/11
$ ghstack land https://github.com/yang/stacktest/pull/11
$ git fetch origin
$ git merge-base origin/main origin/gh/yang/10/orig
$ git rev-list --reverse --header ^434a2cc1abc218f01b20e9ae7aa9a57f8ceb1538
origin/gh/yang/10/orig
$ git symbolic-ref --short HEAD
$ git checkout origin/main
Note: switching to 'origin/main'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at ca8b10f b
$ git cherry-pick origin/gh/yang/8/orig
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:
git commit --allow-empty
Otherwise, please use 'git cherry-pick --skip'
$ git cherry-pick --abort
$ git checkout main
Previous HEAD position was ca8b10f b
Switched to branch 'main'
ERROR: Fatal exception
Traceback (most recent call last):
File
"/Users/yang/.virtualenvs/wab/lib/python3.8/site-packages/ghstack/logging.py",
line 108, in manager
yield
File
"/Users/yang/.virtualenvs/wab/lib/python3.8/site-packages/ghstack/__main__.py",
line 129, in main
ghstack.land.main(
File
"/Users/yang/.virtualenvs/wab/lib/python3.8/site-packages/ghstack/land.py",
line 88, in main
sh.git("cherry-pick", remote_name + "/" + sref)
File
"/Users/yang/.virtualenvs/wab/lib/python3.8/site-packages/ghstack/shell.py",
line 272, in git
return self._maybe_rstrip(self.sh(*(("git",) + args), **kwargs))
File
"/Users/yang/.virtualenvs/wab/lib/python3.8/site-packages/ghstack/shell.py",
line 211, in sh
raise RuntimeError(
RuntimeError: git cherry-pick origin/gh/yang/8/orig failed with exit code 1
$ # Now I try to first rebase onto origin/main and then resubmit.
$ git rebase
First, rewinding head to replay your work on top of it...
Applying: c
$ ghstack
$ git remote get-url origin
$ git fetch origin
$ git merge-base origin/main HEAD
$ git rev-list --header ^ca8b10f42326b06ae66f9b5da0ec262be0fd0883 HEAD
$ git rev-list --header ^ca8b10f42326b06ae66f9b5da0ec262be0fd0883^@
ca8b10f42326b06ae66f9b5da0ec262be0fd0883
$ git rev-list --max-count=1 --header origin/gh/yang/10/orig
$ git rev-parse origin/gh/yang/10/head
$ git rev-parse origin/gh/yang/10/orig
$ git rev-parse 2e33ca396fda250d7311ea18183306f6b9e4b808^{tree}
$ git reset --soft 2e33ca396fda250d7311ea18183306f6b9e4b808
# Updating https://github.com/yang/stacktest/pull/11
# Summary of changes (ghstack 0.3.1)
- Skipped https://github.com/yang/stacktest/pull/11
Facebook employees can import your changes by running
(on a Facebook machine):
ghimport -s https://github.com/yang/stacktest/pull/11
If you want to work on this diff stack on another machine:
ghstack checkout https://github.com/yang/stacktest/pull/11
$ ghstack land https://github.com/yang/stacktest/pull/11
$ git fetch origin
$ git merge-base origin/main origin/gh/yang/10/orig
$ git rev-list --reverse --header ^434a2cc1abc218f01b20e9ae7aa9a57f8ceb1538
origin/gh/yang/10/orig
$ git symbolic-ref --short HEAD
$ git checkout origin/main
Note: switching to 'origin/main'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at ca8b10f b
$ git cherry-pick origin/gh/yang/8/orig
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:
git commit --allow-empty
Otherwise, please use 'git cherry-pick --skip'
$ git cherry-pick --abort
$ git checkout main
Previous HEAD position was ca8b10f b
Switched to branch 'main'
ERROR: Fatal exception
Traceback (most recent call last):
File
"/Users/yang/.virtualenvs/wab/lib/python3.8/site-packages/ghstack/logging.py",
line 108, in manager
yield
File
"/Users/yang/.virtualenvs/wab/lib/python3.8/site-packages/ghstack/__main__.py",
line 129, in main
ghstack.land.main(
File
"/Users/yang/.virtualenvs/wab/lib/python3.8/site-packages/ghstack/land.py",
line 88, in main
sh.git("cherry-pick", remote_name + "/" + sref)
File
"/Users/yang/.virtualenvs/wab/lib/python3.8/site-packages/ghstack/shell.py",
line 272, in git
return self._maybe_rstrip(self.sh(*(("git",) + args), **kwargs))
File
"/Users/yang/.virtualenvs/wab/lib/python3.8/site-packages/ghstack/shell.py",
line 211, in sh
raise RuntimeError(
RuntimeError: git cherry-pick origin/gh/yang/8/orig failed with exit code 1
from ghstack.
@ezyang - Is this still a bug or should the workflow simply be to always run ghstack --no-skip
after rebase?
from ghstack.
it's still a bug!
from ghstack.
Any tips on how to fix this? I might open a PR.
from ghstack.
I'm not sure what the best way to fix this is, but one way that would definitely work is for ghstack land to detect if a commit in the stack has already been landed (e.g., by checking if the PR is already closed), and skipping it if so.
from ghstack.
Related Issues (20)
- Would it be possible to turn this into a gh extension? HOT 2
- Update PR description when rewording a commit on the stack HOT 1
- Permission denied to create PR via ghstack HOT 3
- Hitting github rate limits HOT 2
- ghstack is not compatible with git-2.17 (default for Ubuntu-18.04) HOT 2
- ghstack can be put into a bad state if PR is not ready to merge HOT 1
- typed-ast doesn't build on python 3.11 HOT 4
- Hitting GitHub API limits
- Why can't the base of the stack be the actual main branch? HOT 7
- Problem when tree doesn't change but commit structure has changed HOT 2
- Unpin `importlib_metadata` requirement? HOT 1
- Set assignee/reviewers, maybe based on commit message? HOT 1
- Consider using click for CLI/argument parsing? HOT 1
- ghstack land can land a stack you didn't specify if they share branches HOT 1
- ghstack checkout should not require creds
- `git rev-list` failed when updating stack HOT 4
- Fail to find ~/.ghstackrc on Windows
- Beginner question: how to get ghstack alias? HOT 3
- ghstack cherry-pick HOT 1
- ghstack crashing nondeterministically HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ghstack.