Uwe Brauer <o...@mat.ucm.es> writes:

Hi

I am sorry for this elementary question, but I am a regular mercurial user and I am confused about the following

I want to pull the latest changes

git pull

I obtain

,----
| Updating 83a915d..8c80430
| error: Your local changes to the following files would be overwritten by merge:
|         lisp/vc/diff-mode.el
|         lisp/vc/vc.el
| Please, commit your changes or stash them before you can merge.
| Aborting
`----
that is a bit odd, mercurial would allow the pull and would not need to stash (shelve) anyhow.

If you read the text is says that it would _overwrite_ local changes. I think it's very nice of git to help you not lose work. If all you want to do is get the upstream changes to your local system you should look at the command `git fetch`.

So I want to commit these changes but to a different branch.

So I run

git branch vc-diff-disp

The branch is created

 git branch -a


* master
  vc-diff-disp



But not active. So I cannot commit

 git ci


,----
| On branch master
| Your branch is behind 'origin/master' by 1915 commits, and can be fast-forwarded.
|   (use "git pull" to update your local branch)
| Changes not staged for commit:
|         modified:   lisp/vc/diff-mode.el
|         modified:   lisp/vc/vc.el
|
| no changes added to commit
|
`----

At this state I am lost (in mercurial after the branch command, it would commit to that branch, but git does not)

I tried out


git checkout -b vc-diff-disp
fatal: A branch named 'vc-diff-disp' already exists.

What shall I do?

You should drop the `-b`, you switch to your branch using just `git checkout vc-diff-disp`. Then you need to stage your changes `git add lisp/vc/diff-mode.el lisp/vc/vc.el`, and finally commit them with `git commit`.

I think you'd find it very worthwhile investing time in learning the differences between git and mercurial. Using mercurial you've learnt a lot of things that are general to distributed version control, but you can't transfer _all_ your mercurial knowledge to git.

/M

--
Magnus Therning                   OpenPGP: 0x927912051716CE39
email: mag...@therning.org
@magthe@mastodon.technology       http://magnus.therning.org/

Every act of creation is first an act of destruction.
    — Pablo Picasso

--
You received this message because you are subscribed to the Google Groups "Git for 
human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/87v933g3bu.fsf%40therning.org.

Attachment: signature.asc
Description: PGP signature

Reply via email to