On Monday, November 19, 2012 12:05:43 AM UTC+1, Cesar Casasola wrote:

> In this case there are two commits
>
>
> $ git log --graph --oneline --decorate --all****
>
> * 9d62a1f (HEAD, master) -Actualizacion de .gitignore****
>
> * d4392db Actualizacion de .gitignore para no incluri los archivos del 
> tipo .db****
>
> * 9e9d5f7 -Actualizacion de .gitignore****
>
> * eef0663 commit antes de actualizar****
>
> * fe14405 -Implementacion de una clase Java que permite seleccionar los 
> usuarios****
>
> | *   261f502 (origin/master) Merge branch 'master' of file**
>
> | |\****
>
> | |/****
>
> |/|****
>
> * | cb9269a -Modificacion del ...****
>
> * |   d400eba Merge remote-tracking branch 'origin/master'
>
>
> How I can to merge the commits *261f502* and *9d62a1f?*
>

So, you are currently on the *local* branch master branch, and *9d62a1f* is 
the tip of your local development. 

At the same time, at least up unto the last time you did a git fetch, the *
remote* branch origin/master is on *261f502*.

You *diverged* (went a different path) than the remote origin/master branch 
in commit *cb9269a*, so that would be the common ancestor between your 
local master branch and the remote master branch.

Locally, you have made *five commits* since the common ancestor, while the 
remote origin/master branch has only gotten one commit. So I'm not sure 
where you are counting "two commits".

So now, you want to join together the development which has taken place 
remotely, with what you have done locally.

The most obvious way to do it is to merge the development in origin master 
into your current branch:

git merge origin/master

This will create a merge commit (and prompt you for a commit message to 
explain what is being merged together).

However, some people prefer to avoid these merge-commits when possible, and 
rebase their local commits to be placed *after* the remote commits:

git rebase origin/master

(Note: You should *only* rebase history which has not been shared with 
others).
 

> If they were three or more commits?
>

I'm not sure what you mean by this question. Please provide some more 
context for us to answer it. 

-- 


Reply via email to