* Binary files in a linear repository [not found] <S1754797AbZKBONX/20091102141323Z+268@vger.kernel.org> @ 2009-11-02 15:08 ` Markus Hitter 2009-11-02 15:34 ` Björn Steinbrink 2009-11-02 15:48 ` Dmitry Potapov 0 siblings, 2 replies; 8+ messages in thread From: Markus Hitter @ 2009-11-02 15:08 UTC (permalink / raw) To: git Hello all, currently I'm planning a frontend tool which makes use of only a small subset of git. The repo's contents is all binary (think of pictures). Accordingly, I can't merge in a meaningful way, making branches of very limited use. The situation I'm trying to solve is: - A revision earlier than the latest one is checked out. - Files of this earlier commit are modified. - I want to record this earlier commit along with it's modifications as a new commit on top of master, ignoring intermediate commits: com005 <-- master com004 com003 <-- HEAD, files modified com002 com001 (initial commit) One solution to do this is to move all files somewhere else, check out master, deleting all checked out files, placing the moved away files back into place and committing the result as com006. Obviously, this is a pretty complex operation, just waiting to exploit coding mistakes. Additionally, this will be slow. Now I'm thinking about a much simpler solution: Simply declare the current set of files as (a modified) master/com005 and commit them. A "cp $GIT_DIR/master $GIT_DIR/HEAD" followed by a commit would do it. Now my question: Is it safe to tweak the files in $GIT_DIR this way or will this corrupt the repository? Thanks for any opinions, Markus ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Binary files in a linear repository 2009-11-02 15:08 ` Binary files in a linear repository Markus Hitter @ 2009-11-02 15:34 ` Björn Steinbrink 2009-11-02 15:48 ` Dmitry Potapov 1 sibling, 0 replies; 8+ messages in thread From: Björn Steinbrink @ 2009-11-02 15:34 UTC (permalink / raw) To: Markus Hitter; +Cc: git On 2009.11.02 16:08:25 +0100, Markus Hitter wrote: > The situation I'm trying to solve is: > > - A revision earlier than the latest one is checked out. > > - Files of this earlier commit are modified. > > - I want to record this earlier commit along with it's modifications > as a new commit on top of master, ignoring intermediate commits: > > com005 <-- master > com004 > com003 <-- HEAD, files modified > com002 > com001 (initial commit) > > One solution to do this is to move all files somewhere else, check > out master, deleting all checked out files, placing the moved away > files back into place and committing the result as com006. > Obviously, this is a pretty complex operation, just waiting to > exploit coding mistakes. Additionally, this will be slow. Instead of doing "git checkout com003", which detaches HEAD, you could do: git read-tree -u --reset com003 Which will update the index and working tree to reflect the contents of com003. The modify stuff, add, commit, done. > Now I'm thinking about a much simpler solution: Simply declare the > current set of files as (a modified) master/com005 and commit them. > A "cp $GIT_DIR/master $GIT_DIR/HEAD" followed by a commit would do > it. > > Now my question: Is it safe to tweak the files in $GIT_DIR this way > or will this corrupt the repository? Ignoring that $GIT_DIR/master is the wrong path, that 'cp' would (at best) act like detaching HEAD. Björn ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Binary files in a linear repository 2009-11-02 15:08 ` Binary files in a linear repository Markus Hitter 2009-11-02 15:34 ` Björn Steinbrink @ 2009-11-02 15:48 ` Dmitry Potapov 2009-11-02 16:09 ` Björn Steinbrink 1 sibling, 1 reply; 8+ messages in thread From: Dmitry Potapov @ 2009-11-02 15:48 UTC (permalink / raw) To: Markus Hitter; +Cc: git On Mon, Nov 02, 2009 at 04:08:25PM +0100, Markus Hitter wrote: > > Now I'm thinking about a much simpler solution: Simply declare the > current set of files as (a modified) master/com005 and commit them. A > "cp $GIT_DIR/master $GIT_DIR/HEAD" followed by a commit would do it. > > Now my question: Is it safe to tweak the files in $GIT_DIR this way or > will this corrupt the repository? You probably should use 'git update-ref' if you want to change HEAD manually. But it seems to me that you do not need even that. All what you need is: $ git reset --soft master and then commit your changes (git reset --soft does not touch the index file nor the working tree at all). Dmitry ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Binary files in a linear repository 2009-11-02 15:48 ` Dmitry Potapov @ 2009-11-02 16:09 ` Björn Steinbrink 2009-11-02 16:52 ` Dmitry Potapov 0 siblings, 1 reply; 8+ messages in thread From: Björn Steinbrink @ 2009-11-02 16:09 UTC (permalink / raw) To: Dmitry Potapov; +Cc: Markus Hitter, git On 2009.11.02 18:48:31 +0300, Dmitry Potapov wrote: > On Mon, Nov 02, 2009 at 04:08:25PM +0100, Markus Hitter wrote: > > > > Now I'm thinking about a much simpler solution: Simply declare the > > current set of files as (a modified) master/com005 and commit them. A > > "cp $GIT_DIR/master $GIT_DIR/HEAD" followed by a commit would do it. > > > > Now my question: Is it safe to tweak the files in $GIT_DIR this way or > > will this corrupt the repository? > > You probably should use 'git update-ref' if you want to change HEAD > manually. But it seems to me that you do not need even that. All what > you need is: > > $ git reset --soft master > > and then commit your changes (git reset --soft does not touch the index > file nor the working tree at all). But then you still have to do: git checkout master git merge HEAD@{1} To actually update the "master" branch head. The reset doesn't re-attach HEAD. Björn ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Binary files in a linear repository 2009-11-02 16:09 ` Björn Steinbrink @ 2009-11-02 16:52 ` Dmitry Potapov 2009-11-02 17:01 ` Björn Steinbrink 0 siblings, 1 reply; 8+ messages in thread From: Dmitry Potapov @ 2009-11-02 16:52 UTC (permalink / raw) To: Björn Steinbrink; +Cc: Markus Hitter, git On Mon, Nov 02, 2009 at 05:09:03PM +0100, Björn Steinbrink wrote: > On 2009.11.02 18:48:31 +0300, Dmitry Potapov wrote: > > On Mon, Nov 02, 2009 at 04:08:25PM +0100, Markus Hitter wrote: > > > > > > Now I'm thinking about a much simpler solution: Simply declare the > > > current set of files as (a modified) master/com005 and commit them. A > > > "cp $GIT_DIR/master $GIT_DIR/HEAD" followed by a commit would do it. > > > > > > Now my question: Is it safe to tweak the files in $GIT_DIR this way or > > > will this corrupt the repository? > > > > You probably should use 'git update-ref' if you want to change HEAD > > manually. But it seems to me that you do not need even that. All what > > you need is: > > > > $ git reset --soft master > > > > and then commit your changes (git reset --soft does not touch the index > > file nor the working tree at all). > > But then you still have to do: > git checkout master > git merge HEAD@{1} > > To actually update the "master" branch head. The reset doesn't re-attach > HEAD. You are right... I forgot about that somehow. So, it should be $ git reset --soft master $ git checkout master and only then $ git commit Dmitry ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Binary files in a linear repository 2009-11-02 16:52 ` Dmitry Potapov @ 2009-11-02 17:01 ` Björn Steinbrink 2009-11-02 17:45 ` Dmitry Potapov 0 siblings, 1 reply; 8+ messages in thread From: Björn Steinbrink @ 2009-11-02 17:01 UTC (permalink / raw) To: Dmitry Potapov; +Cc: Markus Hitter, git On 2009.11.02 19:52:15 +0300, Dmitry Potapov wrote: > On Mon, Nov 02, 2009 at 05:09:03PM +0100, Björn Steinbrink wrote: > > On 2009.11.02 18:48:31 +0300, Dmitry Potapov wrote: > > > On Mon, Nov 02, 2009 at 04:08:25PM +0100, Markus Hitter wrote: > > > You probably should use 'git update-ref' if you want to change HEAD > > > manually. But it seems to me that you do not need even that. All what > > > you need is: > > > > > > $ git reset --soft master > > > > > > and then commit your changes (git reset --soft does not touch the index > > > file nor the working tree at all). > > > > But then you still have to do: > > git checkout master > > git merge HEAD@{1} > > > > To actually update the "master" branch head. The reset doesn't re-attach > > HEAD. > > You are right... I forgot about that somehow. So, it should be > > $ git reset --soft master > $ git checkout master > > and only then > > $ git commit That would do, but: git checkout <commit> *make changes* git reset --soft master git checkout master git commit seems unnecessarily complicated, when you could as well do: git read-tree -u --reset <commit> *make changes* git commit Björn ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Binary files in a linear repository 2009-11-02 17:01 ` Björn Steinbrink @ 2009-11-02 17:45 ` Dmitry Potapov 2009-11-02 18:37 ` Björn Steinbrink 0 siblings, 1 reply; 8+ messages in thread From: Dmitry Potapov @ 2009-11-02 17:45 UTC (permalink / raw) To: Björn Steinbrink; +Cc: Markus Hitter, git On Mon, Nov 02, 2009 at 06:01:06PM +0100, Björn Steinbrink wrote: > > That would do, but: > git checkout <commit> > *make changes* > git reset --soft master > git checkout master > git commit > > seems unnecessarily complicated, when you could as well do: > git read-tree -u --reset <commit> > *make changes* > git commit I thought Markus *already* had made changes on that commit, but maybe I misread what he wrote... Dmitry ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Binary files in a linear repository 2009-11-02 17:45 ` Dmitry Potapov @ 2009-11-02 18:37 ` Björn Steinbrink 0 siblings, 0 replies; 8+ messages in thread From: Björn Steinbrink @ 2009-11-02 18:37 UTC (permalink / raw) To: Dmitry Potapov; +Cc: Markus Hitter, git On 2009.11.02 20:45:46 +0300, Dmitry Potapov wrote: > I thought Markus *already* had made changes on that commit, but > maybe I misread what he wrote... Hm, I understood that the described scenario is one he wants to implement in his front-end, and that he was asking for advice how to do it. I guess only Martin can tell for sure, so let's see :-) Björn ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-11-02 18:38 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <S1754797AbZKBONX/20091102141323Z+268@vger.kernel.org>
2009-11-02 15:08 ` Binary files in a linear repository Markus Hitter
2009-11-02 15:34 ` Björn Steinbrink
2009-11-02 15:48 ` Dmitry Potapov
2009-11-02 16:09 ` Björn Steinbrink
2009-11-02 16:52 ` Dmitry Potapov
2009-11-02 17:01 ` Björn Steinbrink
2009-11-02 17:45 ` Dmitry Potapov
2009-11-02 18:37 ` Björn Steinbrink
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).