2016-01-18 22:36 GMT+03:00 Bram Moolenaar <[email protected]>:

>
> John Little wrote:
>
> > On Sunday, January 17, 2016 at 4:59:10 AM UTC+13, LCD 47 wrote:
> > >     The trick is to use "--set-upstream-to".  Something like this:
> > >
> > >         git clone https://github.com/vim/vim.git
> > >         cd vim
> > >         git co -b local
> > >         git br -u origin/master
> > >
> > >     This creates a branch named "local", switches to it, and sets it up
> > > so that when you run "git pull" it merges changes from GitHub.  After
> > > that you can just patch and commit your changes to this branch:
> > >
> > >         ... edit ...
> > >         git ci -am 'Some work done.'
> > >         ... edit ...
> > >         git ci -am 'Some more work done.'
> > >
> > >     "git pull" will then merge changes to upstream master to your
> > > branch, keeping your changes:
> > >
> > >         git pull
> >
> > I've following the instructions on vim.org, which says if you have
> > local changes use git fetch followed by git merge.  This has been a
> > dog's breakfast at times, with me running various git commands I don't
> > understand (as suggested by cryptic messages) trying to shut git up.
>
> For that reason I have changed the instructions to something that should
> always (always?) work:
>
>         git stash
>         git pull
>         git stash pop
>
> Well, you can still run into merge conflicts, and then you're in trouble
> again.  It's not easy to find out what to do, even just saying "I don't
> care, just trhow away my local changes" does not have an obvious git
> command.  I would expect "git revert <filename>", but that doesn't work.
> "git checkout <filename>" sometimes works.  Perhaps with "-f"?
>

​git checkout -f if you want to throw away all your changes.​ git reset
--hard HEAD should also work AFAIK. git revert has completely different
purpose: it is not revert from mercurial, it is backout from mercurial.

If this was proper merging/rebasing of local commits and not stash
manipulation (even though it creates commits behind the schene) there would
be an option to throw away local changes in case of conflict which has
better granularity (local changes will be thrown away only in case of
conflict).

In any case for keeping local changes something like regular git branches
are much better then stash.


>
> Let's face it, git is nice if you know how to use it, and otherwise it's
> a very annoying tool.
>

​I would not say that any VCS expects user not to commit his changes.​



>
> > runtime/doc/tags usually gives trouble, despite me putting it in
> > .gitignore, and deleting it locally.  Today it was:
> >
> > $ git merge
> > CONFLICT (modify/delete): runtime/doc/tags deleted in HEAD and modified
> in refs/remotes/origin/master. Version refs/remotes/origin/master of
> runtime/doc/tags left in tree.
> > Automatic merge failed; fix conflicts and then commit the result.
> > $ rm runtime/doc/tags
> > $ git merge
> > error: merge is not possible because you have unmerged files.
> > hint: Fix them up in the work tree, and then use 'git add/rm <file>'
> > hint: as appropriate to mark resolution and make a commit, or use
> > hint: 'git commit -a'.
> > fatal: Exiting because of an unresolved conflict.
> > $ git commit -a
> > [master 589478d] Merge remote-tracking branch
> 'refs/remotes/origin/master'
> >
> > How should I make this runtime/doc/tags stuff go away?  .gitignore
> doesn't.
> >
> > Or, would I be better with the cryptic commands above?  (I say cryptic
> because  '... use "--set-upstream-to". Something like ...' followed by
> commands where --set-upstream-to does not appear.)
>
> --
> I used to be indecisive, now I'm not sure.
>
>  /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net
>  \\\
> ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/
> \\\
> \\\  an exciting new programming language -- http://www.Zimbu.org
> ///
>  \\\            help me help AIDS victims -- http://ICCF-Holland.org
> ///
>
> --
> --
> You received this message from the "vim_dev" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups
> "vim_dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui