Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pr_finish() should check if local branch is ahead of remote #805

Closed
maurolepore opened this issue Jul 7, 2019 · 2 comments
Closed

pr_finish() should check if local branch is ahead of remote #805

maurolepore opened this issue Jul 7, 2019 · 2 comments

Comments

@maurolepore
Copy link
Contributor

@maurolepore maurolepore commented Jul 7, 2019

Ups, I lost the PR (luckily just one line). I run pr_fetch(), committed, then run pr_finish() without running pr_push(). Silly my -- I should have pushed. I guess I didn't know what to expect and didn't read the docs (oh no!). Am I the only one learning this the hard way? Would it make sense for pr_finish() to check against the remote and ask to confirm if the local repo is behind?

@jennybc
Copy link
Member

@jennybc jennybc commented Jul 8, 2019

Yeah, it sounds like there should be more safeguards here. I think pr_pause() is what you probably wanted.

It sounds like in this case, that the local repo is ahead, but being behind is more typical (because maintainer or someone else has updated the branch). In any case, internally we do have git_branch_compare() to use in this case.

If it had been a more extensive piece of work that you "lost", you could retrieve it from the reflog. But I realize that no one likes going into the reflog 😬

@jennybc jennybc changed the title Ups, so pr_finish() can bite. pr_finish() should check if local branch is ahead of remote Jul 8, 2019
@hadley hadley closed this in 804d58b Oct 17, 2019
@hadley
Copy link
Member

@hadley hadley commented Oct 17, 2019

@jennybc this was easier than expected since we already have check_branch_pushed()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants