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

Process of updating a local branch from another with tracking

From
RDRobert Dailey <rcdailey.lists@gmail.com>
Date
Feb 12, 2014, 21:55 UTC
Message-ID
<CAHd499CQK7Mmd+vWb74Nj4usX8KhmurJNd31MrAMUs6Vb2zOOw@mail.gmail.com>

I have the following alias defined: sync = "!f() { cbr=$(git rev-parse --abbrev-ref HEAD); git co $1 && git pull && git co $cbr && git rebase $1; }; f"

The goal is to basically update a local branch which tracks a branch on a remote, and then rebase my local topic branch onto that updated local branch.

I do this instead of just rebasing onto origin/master. Example:

git checkout master git pull --rebase origin master git checkout topic1 git rebase master

I could do this instead but not sure if it is recommended:

git checkout topic1 git fetch git rebase origin/master

Any thoughts on the alias I created? I'm a Windows user and still new to linux stuff, so if it sucks or could be simplified just let me know.

And as a secondary question, just curious what people think about rebasing onto a remote tracking branch. When I do merges I usually refer to the remote branch, but during rebase I use the local branch instead, but I don't know if there is any functional reason to not skip the local branch and go straight to the remote tracking branch (it saves a step).

Next: Chris Packham
Message 1 of 2 in “Process of updating a local branch from another with tracking”
  1. Robert DaileyFeb 12, 2014
  2. Chris PackhamFeb 13, 2014

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.