Op 2-4-2012 16:21, Pavel Sanda schreef:
Vincent van Ravesteijn wrote:
You had made local commits onto your master branch. If you then do 'git
pull'. It will fetch the commits from the master branch at the server and
merge them with your local commits.
Thanks for all you answers; started to push things into wiki, so we don't
need to ask it again and again here (http://wiki.lyx.org/Devel/Git).

Personally I really advice to always create a new branch to do your own
development.
Yes I know :)

 From some previous posts I extracted into wiki:
git checkout -b myfeature
... edit something
git commit -a
git push origin myfeature:master

The merge command you propose is: ...

If the master branch at origin doesn't have new commits, this can be done without a merge. Otherwise you'll have to rebase your feature on top of master

(on branch myfeature)
$ git rebase master

If we don't stick to the linear master branch idea, then you can first merge your branch into master:

$ git checkout master
$ git merge myfeature
$ git push

I suppose (but never really tried) that by default plain "git push" won't
push any local branches unless (once?) explicitely sent via "git push origin 
myfeature:master".

No, with the above notation, you push the commits in the branch myfeature to the master branch at origin. By default "git push" will only push branches that have a branch with the same name at the remote.

The default is changing now though, to either 'current' or 'upstream'. You can specify it yourself with e.g., "git config push.default current". The latter will indeed by default push your branch myfeature to the remote master branch, if and only if the myfeature branch is set up to track origin/master.

The following will create a new branch at the remote:

$ git push origin myfeature

Now "git push" will also automatically push your branch myfeature.


I know how to do it otherwise but is there some simple merge command which
put the whole branch as a single commit into master without noticing others
about the branch-history-mess in my local tree?

(on branch master)
$ git merge myfeature --squash
$ git commit
<edit the commit log to your likings>

Vincent

Reply via email to