[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] git: committing content and mode changes together
From: |
Greg Chicares |
Subject: |
[lmi] git: committing content and mode changes together |
Date: |
Fri, 4 Nov 2016 01:59:36 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.3.0 |
Working with one particular file (in a proprietary repository),
I changed its contents and its mode, thus:
git update-index --chmod=-x my_file.txt
sed -i my_file.txt -e's/ //g'
and then committed it
git commit my_file.txt -m'Remove tabs and executable bit'
but the mode change didn't get committed.
Then I did a 'reset --hard', and split it into two steps:
git update-index --chmod=-x my_file.txt
git commit my_file.txt -m'Reset executable bit'
and that step worked, but then when I did this:
sed -i my_file.txt -e's/ //g'
git commit my_file.txt -m'Remove tabs'
the mode change was reverted. The output has scrolled away into nirvana,
but IIRC correctly the log said
old mode 100644
new mode 100755
and
git ls-tree HEAD |grep my_file.txt
showed the wrong mode, as did 'ls -l my_file.txt'.
Finally I found something that seemed to work: 'reset --hard', then
chmod -x my_file.txt
and then repeat the (split) steps above.
Why did this seem so difficult? I guess I must be missing something
fundamental, because usually I can find a stackoverflow article that
helps, but this time I can't. I did find this:
http://stackoverflow.com/questions/1611211/how-do-i-make-git-accept-mode-changes-without-accepting-all-text-changes/1611681#1611681
which shows how to commit content and mode changes separately, but
my problem is the opposite: I want to commit them together. What's
the simple, obvious sequence of steps to do that?
- [lmi] git: committing content and mode changes together,
Greg Chicares <=
- Re: [lmi] git: committing content and mode changes together, Vadim Zeitlin, 2016/11/04
- Re: [lmi] git: committing content and mode changes together, Greg Chicares, 2016/11/04
- Re: [lmi] git: committing content and mode changes together, Vadim Zeitlin, 2016/11/04
- Re: [lmi] git: committing content and mode changes together, Greg Chicares, 2016/11/04
- Re: [lmi] git: committing content and mode changes together, Vadim Zeitlin, 2016/11/04
- Re: [lmi] git: committing content and mode changes together, Greg Chicares, 2016/11/04
- Re: [lmi] git: committing content and mode changes together, Vadim Zeitlin, 2016/11/04
- [lmi] Symlink .git/hooks [Was: git: committing content and mode changes together], Greg Chicares, 2016/11/04
- Re: [lmi] Symlink .git/hooks [Was: git: committing content and mode changes together], Greg Chicares, 2016/11/05
- Re: [lmi] Symlink .git/hooks, Vadim Zeitlin, 2016/11/05