{"thread":{"id":"32023","subject":"Re: Like commit -a, but...","startedAt":"2012-11-05T20:29:48Z","lastAt":"2012-11-05T22:36:23Z","messageCount":4,"participants":["Andreas Krey","Tomas Carnecky","Andreas Schwab"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"202565","messageId":"20121105202948.GA17505@inner.h.apk.li","threadId":"32023","inReplyTo":null,"subject":"Like commit -a, but...","fromName":"Andreas Krey","fromEmail":"a.krey@gmx.de","sentAt":"2012-11-05T20:29:48Z","receivedAt":"2012-11-05T20:29:48Z","isPatch":false,"sender":{"key":"a.krey@gmx.de","avatar":"https://avatars.githubusercontent.com/u/37810?v=4"},"body":"Hi all,\n\nI have a workflow for which I can't quite find the git tooling.\n\nEssentially what I want is like 'git commit -a', except that I\nwant the resulting commit on a branch I name instead of the current\none, and I want my current index not being modified. At the moment\nI emulate that via\n\n  git commit -a -m TEMP\": `date` $*\" && \\\n  git push -f nsd master:temp && \\\n  git reset HEAD^ && \\\n\nbut that a) changes the index (ok, not that bad), and it\nwill change my current commit in the case that there are\nno unmodified files (no commit -> head doesn't point\nwhere I want). Ok, that can be prevented by --allow-empty.\n\nBut still I'd like to know if there is a cleaner solution,\nesp. with respect to the index.\n\n(Ah, the point of all this is to take the exact current worktree and\npush it to a compile&deploy server; I don't want to chop my work into\ncommits before I even could compile it.)\n\nAndreas\n\n\n\n-- \n\"Totally trivial. Famous last words.\"\nFrom: Linus Torvalds <torvalds@*.org>\nDate: Fri, 22 Jan 2010 07:29:21 -0800\n"},{"id":"202564","messageId":"20121105205628.GG21244@inner.h.apk.li","threadId":"32023","inReplyTo":"20121105202948.GA17505@inner.h.apk.li","subject":"Re: Like commit -a, but...","fromName":"Andreas Krey","fromEmail":"a.krey@gmx.de","sentAt":"2012-11-05T20:56:28Z","receivedAt":"2012-11-05T20:56:28Z","isPatch":false,"sender":{"key":"a.krey@gmx.de","avatar":"https://avatars.githubusercontent.com/u/37810?v=4"},"body":"On Mon, 05 Nov 2012 21:29:48 +0000, Andreas Krey wrote:\n...\n> But still I'd like to know if there is a cleaner solution,\n> esp. with respect to the index.\n\nActually, it seems\n\n commit -m 'index'\n commit -a -m 'worktree'\n ...push\n git reset HEAD^\n git reset --soft HEAD^\n\nmight do the index trick.\n\nBut is there a direct way to convert the current working tree into a\ntree object?\n\nAndreas\n\n-- \n\"Totally trivial. Famous last words.\"\nFrom: Linus Torvalds <torvalds@*.org>\nDate: Fri, 22 Jan 2010 07:29:21 -0800\n"},{"id":"202567","messageId":"1352151388-ner-1077@calvin","threadId":"32023","inReplyTo":"20121105205628.GG21244@inner.h.apk.li","subject":"Re: Like commit -a, but...","fromName":"Tomas Carnecky","fromEmail":"tomas.carnecky@gmail.com","sentAt":"2012-11-05T21:36:28Z","receivedAt":"2012-11-05T21:36:28Z","isPatch":false,"sender":{"key":"tomas.carnecky@gmail.com","avatar":null},"body":"On Mon, 05 Nov 2012 21:56:28 +0100, Andreas Krey <a.krey@gmx.de> wrote:\n> On Mon, 05 Nov 2012 21:29:48 +0000, Andreas Krey wrote:\n> ...\n> > But still I'd like to know if there is a cleaner solution,\n> > esp. with respect to the index.\n> \n> Actually, it seems\n> \n>  commit -m 'index'\n>  commit -a -m 'worktree'\n>  ...push\n>  git reset HEAD^\n>  git reset --soft HEAD^\n> \n> might do the index trick.\n> \n> But is there a direct way to convert the current working tree into a\n> tree object?\n\nPARENT=$(git rev-parse HEAD)\nTREE=$(git write-tree)\nCOMMIT=$(git commit-tree -p $PARENT -m \"message' $TREE)\ngit push origin $COMMIT:refs/heads/teh-branch\n\nwrite-tree+commit-tree is what git-commit does internally.\n"},{"id":"202570","messageId":"m2fw4nd6e0.fsf@igel.home","threadId":"32023","inReplyTo":"20121105205628.GG21244@inner.h.apk.li","subject":"Re: Like commit -a, but...","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2012-11-05T22:36:23Z","receivedAt":"2012-11-05T22:36:23Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Andreas Krey <a.krey@gmx.de> writes:\n\n> But is there a direct way to convert the current working tree into a\n> tree object?\n\nYou can create a temporary index by setting the GIT_INDEX_FILE env var.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"}]}