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

Re: Strange behauviour on Cherry-Pick

From
Carlos Martín Nieto <cmn@elego.de>
Date
Mar 9, 2012, 17:20 UTC
Message-ID
<1331313612.21444.46.camel@beez.lab.cmartin.tk>
In-Reply-To
<1331296972-sup-5028@masterkorp.net>
On Fri, 2012-03-09 at 15:11 +0100, Alfredo Palhares wrote:
Show 9 quoted lines
> Hello, 
> 
> I have a repository[1] with my home files that i keep track off on my machines. 
> Until now ive been having everything in the same branch across all the computers, 
> but now i have a machine that requires diferences on some files.
> 
> So what i did i branched out and keep control the commits i want to the other branch
> trough cherry-picking.
> 
[cherry-pick two commits from 'boobierack' into 'master']
Show 23 quoted lines
> Back to the boobierack machine:
>   Pull the commits before adding more stuff
>   $ git pull origin 
>   remote: Counting objects: 20, done.
>   remote: Compressing objects: 100% (13/13), done.
>   remote: Total 18 (delta 2), reused 18 (delta 2)
>   Unpacking objects: 100% (18/18), done.
>   From github.com:masterkorp/Home-files
>    * branch            HEAD       -> FETCH_HEAD
>    Merge made by recursive.
> 
>   I got like... OK ? 
>   On branh boobierack
>   $ git log --pretty=format:'''%h : %s''' --date-order --graph -n 6
>   *   4d7b2e8 : Merge github.com:masterkorp/Home-files into boobierack
>   |\  
>   | * 9937a0a : Fancier tmux
>   * | 811355b : Add sup config files
>   * | 9de92a2 : Fancier tmux
>   | * aac85ac : Add weechat config files
>   * | 90a6162 : Add weechat config files
> 
>   And master branch was untouched, i read on recursive merging on man page, but 

The master branch was untouched because you didn't tell git to do anything with it.

>   i can't even understand why is git using that method in the first place, since 
>   the hashes are diferent and git doesn't care about the diff when fetching iirc.

The diffs between branches don't matter when fetching, but this is only part of what you are doing here. Pull is fetch + merge and as you specified a remote and no branch, it took the remote's default branch, which seems to be 'master', and merged it into your current branch. What you show is precisely what one would expect to see. Those two commits that you cherry-picked are on each branch (or rather, their equivalents) and then you have a merge between that remote and branch 'boobierack' which you were on when you told git to merge origin's default branch.

This however doesn't seem to be what you were trying to do. What were you trying to achieve with the pull? It seems to make sense that you'd want to merge the master branch, as you yourself said that it had changes that would never get merged back to 'master'.

   cmn
Previous: Alfredo Palhares
Message 2 of 2 in “Strange behauviour on Cherry-Pick”
  1. Alfredo PalharesMar 9, 2012
  2. Carlos Martín NietoMar 9, 2012

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.