git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Branches, upstreams, rebases and logistics

From
Sstdedos@gmail.com <stdedos@gmail.com>
Date
Mar 30, 2021, 20:28 UTC
Message-ID
<20210330202852.9673-1-stdedos+git@gmail.com>

I was reading this thread: https://lore.kernel.org/git/YFP+KuUn99vftBIC@camp.crustytoothpaste.net/

and, in specific:
> ..., many fixup and squash commits and near constant rebases.
which speaks to me somewhat heavily.

As this could be a discussion forum, I'd like to see how other people are dealing with / have done for these:

I clone a repository, I do changes on top of a branch, I push for review, ... and the cycle continues until merging.

It is trivial, when native `git push/pull` is used to push/pull to/from one remote which I have access, as `pull --rebase` works magically in keeping the local state up-to-date.

It also works with the repos that you do not have direct access to push natively on the branch nowhere, as you can keep using the `pull --rebase` to sync, and "push" with some other method (`refs/for`, `git-send-email`, or others which I don't know).

However, with the Github way of working, that means: I have two remotes, (origin and upstream), on which, I develop and push on the `origin`, but I am really tracking/rebasing on/from `upstream`.

I cannot `--track` upstream, as plain `git push` won't work, and for pull, I have to separately `git fetch --all`, `git rebase upstream/<branch>`

- OR -
I have a branch, which depends on top of another branch (not yet merged upstream).
o - origin/master
 \
  o---o---o---o
  |            \
  fix/local     o--o - (fix/depends-on-local)

For brevity, I am setting "git branch --set-upstream-to=fix/local", which helps, when rebasing fix/local on top of origin/master, to rebase fix/depends-on-local on top of fix/local.

However, as noted above, a branch cannot be pushed upstream easily and have a different upstream set at the same time.

I know my logic/understanding is lacking somewhere; I am looking forward to enlightenment :-D

Next: Jeff King
Message 1 of 2 in “Branches, upstreams, rebases and logistics”
  1. stdedos@gmail.comMar 30, 2021
  2. Jeff KingMar 31, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.