When creating a new branch off of a main branch that is behind its upstream, use the upstream instead #4490
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Very often my local main branch is behind its upstream, because I have no reason to keep it up to date. In the olden days it used to be necessary to keep it up to date in order to rebase feature branches onto it, so you'd have to press
f
on it occasionally before pressingr
. This is no longer necessary now that we have the "rebase onto base branch" command (r b
).The only time I now need an up-to-date local main is when I want to create a new branch off of it. This is annoying, because I have to press
f
and wait for it to complete before I can create a new branch; but I know that origin/main is probably up to date (or close to up to date), because lazygit fetches it in the background all the time. So why can't I just create my new branch off of origin/main, then? (Sure, I could switch over to the Remotes tab, open origin, and select origin/main there, but that's cumbersome.)So this is exactly what this PR does: if the local main is strictly behind its upstream (as opposed to diverged, which should be very rare for a main branch), then when pressing
n
on it we create the new branch off of origin/main.go generate ./...
)