problems with git and maintaining files

2,009 views
Skip to first unread message

Charles E Campbell

unread,
Aug 19, 2016, 4:05:59 PM8/19/16
to vim...@googlegroups.com
Hello:

I'm having a problem with using git and making local changes to files I
maintain. In particular: I make changes to syntax/sh.vim (locally), and
then
git fails:

runtime/syntax/sh.vim: needs merge
runtime/syntax/sh.vim: needs merge
runtime/syntax/sh.vim: unmerged (711971ea4ae7b3a72c2062c18130b3eca35dc67b)
runtime/syntax/sh.vim: unmerged (34b8ab79e45bb1f39827e940e4b3428bedfad64b)
runtime/syntax/sh.vim: unmerged (b285b04979551b260ab016ba089d9e69ded01612)
fatal: git-write-tree: error building trees
Cannot save the current index state
M runtime/doc/syntax.txt
U runtime/syntax/sh.vim
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'.
runtime/syntax/sh.vim: needs merge
...

I don't particularly want to try to merge my changes with the repository;
instead, I just want git to leave my changes alone. My solution so far
involves manually saving the changed files, wiping out the repository
copy on
my local system, getting a fresh copy via git, and putting my changed files
back. Is there a better solution?

Regards,
Chip Campbell

upd

Christ van Willegen

unread,
Aug 19, 2016, 4:14:10 PM8/19/16
to vim...@googlegroups.com

Op 19 aug. 2016 22:05 schreef "Charles E Campbell" <drc...@campbellfamily.biz>:


> My solution so far
> involves manually saving the changed files, wiping out the repository
> copy on
> my local system, getting a fresh copy via git, and putting my changed files
> back.  Is there a better solution?

'git stash push' and 'git stash pop'?

Christ van Willegen

Charles E Campbell

unread,
Aug 19, 2016, 4:28:01 PM8/19/16
to vim...@googlegroups.com
Christ van Willegen wrote:
>
> Op 19 aug. 2016 22:05 schreef "Charles E Campbell"
> <drc...@campbellfamily.biz <mailto:drc...@campbellfamily.biz>>:
> > My solution so far
> > involves manually saving the changed files, wiping out the repository
> > copy on
> > my local system, getting a fresh copy via git, and putting my
> changed files
> > back. Is there a better solution?
>
> 'git stash push' and 'git stash pop'?
>
>
I tried git stash push instead of git push -- and it still doesn't work:

Usage: git stash list [<options>]
or: git stash show [<stash>]
or: git stash drop [-q|--quiet] [<stash>]
or: git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]
or: git stash branch <branchname> [<stash>]
or: git stash [save [--patch] [-k|--[no-]keep-index] [-q|--quiet]
[<message>]]
or: git stash clear
M runtime/doc/syntax.txt
U runtime/syntax/sh.vim
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'.
runtime/syntax/sh.vim: needs merge
Cannot apply to a dirty working tree, please stage your changes

Regards,
Chip Campbell

Christ van Willegen

unread,
Aug 19, 2016, 4:32:12 PM8/19/16
to vim...@googlegroups.com

Op 19 aug. 2016 22:28 schreef "Charles E Campbell" <drc...@campbellfamily.biz>:
>

> I tried git stash push instead of git push -- and it still doesn't work:

Probably only 'stash' then...

Christ van Willegen

Charles E Campbell

unread,
Aug 19, 2016, 4:34:31 PM8/19/16
to vim...@googlegroups.com
Christ van Willegen wrote:
>
> Op 19 aug. 2016 22:28 schreef "Charles E Campbell"
> <drc...@campbellfamily.biz <mailto:drc...@campbellfamily.biz>>:
> >
>
> > I tried git stash push instead of git push -- and it still doesn't work:
>
> Probably only 'stash' then...
>
>
That doesn't work either, unfortunately:

runtime/syntax/sh.vim: needs merge
runtime/syntax/sh.vim: needs merge
runtime/syntax/sh.vim: unmerged (711971ea4ae7b3a72c2062c18130b3eca35dc67b)
runtime/syntax/sh.vim: unmerged (34b8ab79e45bb1f39827e940e4b3428bedfad64b)
runtime/syntax/sh.vim: unmerged (b285b04979551b260ab016ba089d9e69ded01612)
fatal: git-write-tree: error building trees
Cannot save the current index state

Charles E Campbell

unread,
Aug 19, 2016, 4:56:37 PM8/19/16
to vim...@googlegroups.com
Oh, well -- I tried several things based on web searches, and none of
them worked. I just went ahead and did what I know does work -- save
off the affected files manually, wipe out the local copy, git clone
https://github.com/vim/vim.git, and manually copy the affected files
back to where they needed to be.

Regards,
Chip Campbell

Christ van Willegen

unread,
Aug 19, 2016, 5:29:28 PM8/19/16
to vim...@googlegroups.com

git stash
git checkout / git revert
git stash pop
?

Sorry, getting terse, tablets are not helpful for cutting/pasting/editing...

Christ van Willegen

Michael Soyka

unread,
Aug 19, 2016, 6:39:48 PM8/19/16
to vim...@googlegroups.com
On 8/19/2016 4:05 PM, Charles E Campbell wrote:
> Hello:
>
> I'm having a problem with using git and making local changes to files I
> maintain. In particular: I make changes to syntax/sh.vim (locally), and
> then
> git fails:
>
> runtime/syntax/sh.vim: needs merge
> runtime/syntax/sh.vim: needs merge
> runtime/syntax/sh.vim: unmerged (711971ea4ae7b3a72c2062c18130b3eca35dc67b)
> runtime/syntax/sh.vim: unmerged (34b8ab79e45bb1f39827e940e4b3428bedfad64b)
> runtime/syntax/sh.vim: unmerged (b285b04979551b260ab016ba089d9e69ded01612)
> fatal: git-write-tree: error building trees
> Cannot save the current index state
> M runtime/doc/syntax.txt
> U runtime/syntax/sh.vim
> Pull is not possible because you have unmerged files.
> Please, fix them up in the work tree, and then use 'git add/rm <file>'
> as appropriate to mark resolution, or use 'git commit -a'.
> runtime/syntax/sh.vim: needs merge
> ...
>
> I don't particularly want to try to merge my changes with the repository;
> instead, I just want git to leave my changes alone. My solution so far
> involves manually saving the changed files, wiping out the repository
> copy on
> my local system, getting a fresh copy via git, and putting my changed files
> back. Is there a better solution?
>
> Regards,
> Chip Campbell
>
Why not just put your changes in a local branch? You're then free to
pull commits into your master branch and they won't affect your
changes. You can determine if and when you want to merge.

-mike

Marius Gedminas

unread,
Aug 22, 2016, 1:59:28 AM8/22/16
to vim...@googlegroups.com
An entire full clone must be painful. A simpler solution that doesn't
rely on any advanced git mastery would be

mv runtime/syntax/sh.vim runtime/syntax/sh.vim.mine # for each file
git checkout . # restore pristine upstream versions of every file
git pull
mv runtime/syntax/sh.vim.mine runtime/syntax/sh.vim # for each file

HTH,
Marius Gedminas
--
To err is human, but to really foul things up requires a computer.
signature.asc

Charles E Campbell

unread,
Aug 22, 2016, 12:15:41 PM8/22/16
to vim...@googlegroups.com
I'll try this the next time I have the problem -- looks like it should work.

Thank you,
Chip Campbell

Charles E Campbell

unread,
Aug 22, 2016, 12:19:15 PM8/22/16
to vim...@googlegroups.com
Christ van Willegen wrote:
>
> git stash
> git checkout / git revert
> git stash pop
> ?
>
> Sorry, getting terse, tablets are not helpful for
> cutting/pasting/editing...
>
I understand -- I try to avoid using my tablet to say much via email.
I'll give this a go the next time I have the problem.

Thank you,
Chip Campbell
Reply all
Reply to author
Forward
0 new messages