{"thread":{"id":"16376","subject":"git-submodule/before-rebase hook","startedAt":"2008-11-18T03:59:28Z","lastAt":"2008-11-18T07:47:32Z","messageCount":2,"participants":["justin","Andreas Ericsson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"96070","messageId":"CC8B9B47-4985-4B96-B8DB-0B351633C849@justinbalthrop.com","threadId":"16376","inReplyTo":null,"subject":"git-submodule/before-rebase hook","fromName":"justin","fromEmail":"juddhuck@gmail.com","sentAt":"2008-11-18T03:59:28Z","receivedAt":"2008-11-18T03:59:28Z","isPatch":false,"sender":{"key":"juddhuck@gmail.com","avatar":null},"body":"I just discovered git-submodule today, and already I can see it making  \nmy life a lot easier. I develop several modules that are used in two  \ndifferent projects, and being able to check in changes from the  \nsubmodule in either project is something I have been wanting to do for  \na while. But there is one shortcoming in git-submodule that I haven't  \nfigured out how to overcome... yet.\n\nWhen I make a change to a submodule and push that change to the parent  \nrepository, the change appears to all other users of the repository as  \na modification to the submodule commit version. A few people at our  \ncompany use 'git ci -a' to add all of their changes, and I'm afraid  \nthey are going to unknowingly revert the submodule back to a previous  \nversion. So my plan was to add a post-pull hook that does 'git  \nsubmodule update --init', so that people who don't do development on  \nthe submodule will get updates every time they pull. Unfortunately  \nthough, there is no such hook in git. I thought post-merge was going  \nto work, but most people at our company use 'git pull --rebase', and  \npost-merge isn't called in that case. The post-checkout hook is  \ncalled, but the pull hasn't been completed at that point, so updating  \nthe submodule doesn't work. Alas, if only there was a post-rebase hook.\n\nAny ideas other than patching every employee's git source to add a  \npost-rebase hook?\n\nThanks,\nJustin\n"},{"id":"96075","messageId":"49227314.4080709@op5.se","threadId":"16376","inReplyTo":"CC8B9B47-4985-4B96-B8DB-0B351633C849@justinbalthrop.com","subject":"Re: git-submodule/before-rebase hook","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2008-11-18T07:47:32Z","receivedAt":"2008-11-18T07:47:32Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"justin wrote:\n> I just discovered git-submodule today, and already I can see it making \n> my life a lot easier. I develop several modules that are used in two \n> different projects, and being able to check in changes from the \n> submodule in either project is something I have been wanting to do for a \n> while. But there is one shortcoming in git-submodule that I haven't \n> figured out how to overcome... yet.\n> \n> When I make a change to a submodule and push that change to the parent \n> repository, the change appears to all other users of the repository as a \n> modification to the submodule commit version.\n\nIt shouldn't, unless you push the change into a non-bare copy of a checked\nout submodule, but that would be rather insane as the submodule rather\nthan the superproject then gets to decide which version of the submodule\nto use.\n\n> A few people at our \n> company use 'git ci -a' to add all of their changes, and I'm afraid they \n> are going to unknowingly revert the submodule back to a previous \n> version.\n\nAh, now I see where you're coming from. After you issue \"git pull\" in\nthe submodule you have to sync the new version of the submodule to the\nsuperproject using \"git submodule sync\".\n\n> So my plan was to add a post-pull hook that does 'git submodule \n> update --init', so that people who don't do development on the submodule \n> will get updates every time they pull.\n\nOk, I didn't. Why do you pull into the submodules if you don't want to\nsync the code so the superproject gets the benefit of the changes?\n\n> Unfortunately though, there is no \n> such hook in git. I thought post-merge was going to work, but most \n> people at our company use 'git pull --rebase', and post-merge isn't \n> called in that case. The post-checkout hook is called, but the pull \n> hasn't been completed at that point, so updating the submodule doesn't \n> work. Alas, if only there was a post-rebase hook.\n> \n> Any ideas other than patching every employee's git source to add a \n> post-rebase hook?\n> \n\nYes. Only pull in submodules if you intend to sync them afterwards.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"}]}