{"thread":{"id":"11133","subject":"[RFC] Introduce .git/BRANCH to point to the current branch","startedAt":"2007-12-04T20:08:19Z","lastAt":"2007-12-06T23:39:54Z","messageCount":14,"participants":["Salikh Zakirov","Matthieu Moy","Jakub Narebski","Junio C Hamano","Nanako Shiraishi","David Kågedal","Robin Rosenberg"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"61940","messageId":"4755B3B3.80704@gmail.com","threadId":"11133","inReplyTo":null,"subject":"[RFC] Introduce .git/BRANCH to point to the current branch","fromName":"Salikh Zakirov","fromEmail":"salikh@gmail.com","sentAt":"2007-12-04T20:08:19Z","receivedAt":"2007-12-04T20:08:19Z","isPatch":false,"sender":{"key":"salikh@gmail.com","avatar":"https://gravatar.com/avatar/952c102bb1dcf721dab8de4f5a11d276756a65d301d021f755e265cc3251efae?d=mp&s=160"},"body":"\nBefore this change, .git/HEAD file played two roles:\n(a) point to the base commit of the working directory\n(b) point to current branch\n\nThis combination leads to the confusing user experience\nif the branch changes independently of the working directory.\nThis can happen in following cases:\n\n1) git clone repo repo2\n   cd repo2\n   ... edit something\n   git commit -a\n   git push\n\n2) checking out the same branch in the another working directory\nassociated with the same repository, e.g. created by\ncontrib/workdir/git-new-workdir\n\n   git new-workdir repo repo2\n   cd repo2\n   ... edit something\n   git commit -a\n\nIn both cases original repository will report differences between\nindex and HEAD, even if though particular working directory\nstate has not been changed at all.\n\nThis patch separates the notion of the current branch from\nthe base commit. HEAD will always be \"detached\", and will store\nthe hash of the base commit. Newly introduced BRANCH reference\nwill point to the current branch.\n\nWhen new commit is created, it is first stored in the HEAD.\nThen HEAD is compared to the branch head (BRANCH), and branch\nhead is updated only if it is fast forward.\nSo, in all simple case there will be no difference in the workflow.\n\nIn the \"irregular\" use cases above, branch head may diverge from\nthe base commit of the repository. This situation is detected\nby the updaters of the HEAD, and user is advised to run merge.\n---\n\nUnfortunately, I have not figured out how to set up an empty repository\nto use separate HEAD and BRANCH, so one needs to set up an existing\nrepository manually in order to play with this change:\n\n\tgit rev-parse HEAD > .git/HEAD.new\n\tmv .git/HEAD .git/BRANCH\n\tmv .git/HEAD.new .git/HEAD\n\nThe way branch head is updated after HEAD update in this patch\nis clearly unacceptable, as it causes too much code duplication.\nI wonder if it would be better to introduce a special case  in git-update-ref?\n\n git-checkout.sh |    4 +++-\n git-commit.sh   |   16 ++++++++++++++++\n git-merge.sh    |   15 +++++++++++++++\n wt-status.c     |   11 +++++++----\n wt-status.h     |    1 +\n 5 files changed, 42 insertions(+), 5 deletions(-)\n\ndiff --git a/git-checkout.sh b/git-checkout.sh\nindex f6d58ac..8e1a1ab 100755\n--- a/git-checkout.sh\n+++ b/git-checkout.sh\n@@ -266,7 +266,9 @@ if [ \"$?\" -eq 0 ]; then\n \tif test -n \"$branch\"\n \tthen\n \t\told_branch_name=`expr \"z$oldbranch\" : 'zrefs/heads/\\(.*\\)'`\n-\t\tGIT_DIR=\"$GIT_DIR\" git symbolic-ref -m \"checkout: moving from ${old_branch_name:-$old} to $branch\" HEAD \"refs/heads/$branch\"\n+\t\tGIT_DIR=\"$GIT_DIR\" git symbolic-ref -m \"checkout: moving from ${old_branch_name:-$old} to $branch\" BRANCH \"refs/heads/$branch\"\n+\t\tcommit=$(git rev-parse --verify BRANCH 2>/dev/null) &&\n+\t\tgit update-ref --no-deref -m \"checkout: moving from ${old_branch_name:-$old} to $branch\" HEAD \"$commit\"\n \t\tif test -n \"$quiet\"\n \t\tthen\n \t\t\ttrue\t# nothing\ndiff --git a/git-commit.sh b/git-commit.sh\nindex 2c4a406..b7315c1 100755\n--- a/git-commit.sh\n+++ b/git-commit.sh\n@@ -609,7 +609,23 @@ then\n \t\tmv \"$NEXT_INDEX\" \"$THIS_INDEX\"\n \telse\n \t\t: ;# happy\n+\tfi && {\n+\tbranchhead=$(git rev-parse --verify BRANCH 2>/dev/null)\n+\tif test -n \"$branchhead\"\n+\tthen\n+\t\tif test -z \"`git rev-list $commit..$branchhead`\"\n+\t\tthen\n+\t\t\t# fast-forward, update the branch pointer as well\n+\t\t\tgit update-ref -m \"$GIT_REFLOG_ACTION: $rlogm\" BRANCH $commit \"$branchhead\"\n+\t\telse\n+\t\t\tname=$(git symbolic-ref BRANCH | sed 's,refs/heads/,,')\n+\t\t\techo >&2 \"* HEAD diverged from $name\"\n+\t\t\techo >&2 \"* Consider 'git merge $name'\"\n+\t\tfi\n+\telse\n+\t\tgit-update-ref -m \"$GIT_REFLOG_ACTION: $rlogm\" BRANCH $commit \"$branchhead\"\n \tfi\n+\t}\n else\n \techo >&2 \"* no commit message?  aborting commit.\"\n \tfalse\ndiff --git a/git-merge.sh b/git-merge.sh\nindex 1c123a3..3d4b31b 100755\n--- a/git-merge.sh\n+++ b/git-merge.sh\n@@ -94,6 +94,21 @@ finish () {\n \t\t*)\n \t\t\tgit update-ref -m \"$rlogm\" HEAD \"$1\" \"$head\" || exit 1\n \t\t\tgit gc --auto\n+\t\t\tbranchhead=$(git rev-parse --verify BRANCH 2>/dev/null)\n+\t\t\tif test -n \"$branchhead\"\n+\t\t\tthen\n+\t\t\t\tif test -z \"`git rev-list $commit..$branchhead`\"\n+\t\t\t\tthen\n+\t\t\t\t\t# fast-forward, update the branch pointer as well\n+\t\t\t\t\tgit update-ref -m \"$rlogm\" BRANCH \"$1\" \"$branchhead\" || exit 1\n+\t\t\t\telse\n+\t\t\t\t\tname=$(git symbolic-ref BRANCH | sed 's,refs/heads/,,')\n+\t\t\t\t\techo >&2 \"* HEAD diverged from $name\"\n+\t\t\t\t\techo >&2 \"* Consider 'git merge $name'\"\n+\t\t\t\tfi\n+\t\t\telse\n+\t\t\t\tgit-update-ref -m \"$GIT_REFLOG_ACTION: $rlogm\" BRANCH $commit \"$branchhead\"\n+\t\t\tfi\n \t\t\t;;\n \t\tesac\n \t\t;;\ndiff --git a/wt-status.c b/wt-status.c\nindex bf2fe8d..9fe5d10 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -44,12 +44,14 @@ static const char* color(int slot)\n \n void wt_status_prepare(struct wt_status *s)\n {\n-\tunsigned char sha1[20];\n-\tconst char *head;\n+\tunsigned char sha1[20], sha2[20];\n+\tconst char *head, *branch;\n \n \tmemset(s, 0, sizeof(*s));\n \thead = resolve_ref(\"HEAD\", sha1, 0, NULL);\n-\ts->branch = head ? xstrdup(head) : NULL;\n+\tbranch = resolve_ref(\"BRANCH\", sha2, 0, NULL);\n+\ts->diverged = hashcmp(sha1, sha2);\n+\ts->branch = branch ? xstrdup(branch) : NULL;\n \ts->reference = \"HEAD\";\n \ts->fp = stdout;\n \ts->index_file = get_index_file();\n@@ -309,6 +311,7 @@ void wt_status_print(struct wt_status *s)\n \tif (s->branch) {\n \t\tconst char *on_what = \"On branch \";\n \t\tconst char *branch_name = s->branch;\n+\t\tconst char *diverged = (s->diverged ? \", diverged\" : \"\");\n \t\tif (!prefixcmp(branch_name, \"refs/heads/\"))\n \t\t\tbranch_name += 11;\n \t\telse if (!strcmp(branch_name, \"HEAD\")) {\n@@ -316,7 +319,7 @@ void wt_status_print(struct wt_status *s)\n \t\t\ton_what = \"Not currently on any branch.\";\n \t\t}\n \t\tcolor_fprintf_ln(s->fp, color(WT_STATUS_HEADER),\n-\t\t\t\"# %s%s\", on_what, branch_name);\n+\t\t\t\"# %s%s%s\", on_what, branch_name, diverged);\n \t}\n \n \tif (s->is_initial) {\ndiff --git a/wt-status.h b/wt-status.h\nindex 7744932..db8129d 100644\n--- a/wt-status.h\n+++ b/wt-status.h\n@@ -17,6 +17,7 @@ struct wt_status {\n \tint verbose;\n \tint amend;\n \tint untracked;\n+\tint diverged;\n \t/* These are computed during processing of the individual sections */\n \tint commitable;\n \tint workdir_dirty;\n-- \n1.5.3.5.610.g3532b\n"},{"id":"61942","messageId":"vpqbq96jjrf.fsf@bauges.imag.fr","threadId":"11133","inReplyTo":"4755B3B3.80704@gmail.com","subject":"Re: [RFC] Introduce .git/BRANCH to point to the current branch","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-12-04T20:19:00Z","receivedAt":"2007-12-04T20:19:00Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Salikh Zakirov <salikh@gmail.com> writes:\n\n> This combination leads to the confusing user experience\n> if the branch changes independently of the working directory.\n> This can happen in following cases:\n\nThere's another thing that your proposal could change: navigating back\nin history without loosing track of the branch you're on.\n\nCurrently, I can do:\n\n# Oh, what did this look like two commits ago?\n$ git checkout HEAD^^\n# Ah, OK, let's go back to the tip\n$ git checkout branch-name\n               ^^^^^^^^^^^\nBut I have to remember and re-type the branch name.\n\nI can imagine (not tested with your patch) doing just:\n\n$ git checkout HEAD^^\n$ git checkout BRANCH\n\n(that's one point in favor of your change, but I'm not familiar enough\nwith git's internal to say whether this is sufficient to justify the\nchange).\n\n-- \nMatthieu\n"},{"id":"61943","messageId":"m34peyur8r.fsf@roke.D-201","threadId":"11133","inReplyTo":"vpqbq96jjrf.fsf@bauges.imag.fr","subject":"Re: [RFC] Introduce .git/BRANCH to point to the current branch","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-12-04T20:42:43Z","receivedAt":"2007-12-04T20:42:43Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n\n> Salikh Zakirov <salikh@gmail.com> writes:\n> \n> > This combination leads to the confusing user experience\n> > if the branch changes independently of the working directory.\n> > This can happen in following cases:\n\nAll those cases are cases of not recommended workflows.\n\nPlease search the archives for idea of BASE extension to index\n(instead of your separate file under .git/refs), and why it is\nnot in current git.\n\nBTW. how in your proposal would you detach HEAD?\n\n> There's another thing that your proposal could change: navigating back\n> in history without loosing track of the branch you're on.\n> \n> Currently, I can do:\n> \n> # Oh, what did this look like two commits ago?\n> $ git checkout HEAD^^\n> # Ah, OK, let's go back to the tip\n> $ git checkout branch-name\n>                ^^^^^^^^^^^\n> But I have to remember and re-type the branch name.\n\nNo, you don't have. You can use\n  $ git checkout ORIG_HEAD\nor\n  $ git checkout HEAD@{1}\n\n-- \nJakub Narebski\nShadeHawk on #git\nPoland\n"},{"id":"61944","messageId":"7vir3e428i.fsf@gitster.siamese.dyndns.org","threadId":"11133","inReplyTo":"m34peyur8r.fsf@roke.D-201","subject":"Re: [RFC] Introduce .git/BRANCH to point to the current branch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-12-04T20:46:37Z","receivedAt":"2007-12-04T20:46:37Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n>> Currently, I can do:\n>> \n>> # Oh, what did this look like two commits ago?\n>> $ git checkout HEAD^^\n>> # Ah, OK, let's go back to the tip\n>> $ git checkout branch-name\n>>                ^^^^^^^^^^^\n>> But I have to remember and re-type the branch name.\n>\n> No, you don't have. You can use\n>   $ git checkout ORIG_HEAD\n> or\n>   $ git checkout HEAD@{1}\n\nBut the point is he wants to go back to the branch he came from.  He\ndoes not want to detach HEAD at the original commit.\n\nHaving said that, I am not sympathetic to \"I have to remember\".\n"},{"id":"61945","messageId":"vpq4peyjgd7.fsf@bauges.imag.fr","threadId":"11133","inReplyTo":"7vir3e428i.fsf@gitster.siamese.dyndns.org","subject":"Re: [RFC] Introduce .git/BRANCH to point to the current branch","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-12-04T21:32:20Z","receivedAt":"2007-12-04T21:32:20Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Having said that, I am not sympathetic to \"I have to remember\".\n\nThat's definitely not an important point, but I find it conveinient,\nfor example in hg, to be able to just \"hg update\" to get to the tip of\na branch.\n\nA use-case (which joins the one of Salikh actually) is to publish both\na repository and a working tree (I do that for my collegues which may\nor (usually) may not use git). Making a hook to update the working\ntree after a push is a terrible hack in git, and just \"hg update\" in\nMercurial.\n\n(once again, that's one point in favor of base separate from current\nbranch, but it doesn't cancel the possible drawbacks. It seems\nthe thread \"Reverting the whole index-base series\" at\nhttp://thread.gmane.org/gmane.comp.version-control.git/44360/focus=44525\nis interesting to read, I'll dig a bit more.\n\nAs you mention in the thread, detaching head when pushing to a\nchecked-out branch would probably be an interesting option)\n\n-- \nMatthieu\n"},{"id":"61946","messageId":"7veje23zcy.fsf@gitster.siamese.dyndns.org","threadId":"11133","inReplyTo":"vpq4peyjgd7.fsf@bauges.imag.fr","subject":"Re: [RFC] Introduce .git/BRANCH to point to the current branch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-12-04T21:48:45Z","receivedAt":"2007-12-04T21:48:45Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Having said that, I am not sympathetic to \"I have to remember\".\n>\n> That's definitely not an important point, but I find it conveinient,\n> for example in hg, to be able to just \"hg update\" to get to the tip of\n> a branch.\n>\n> A use-case (which joins the one of Salikh actually) is to publish both\n> a repository and a working tree (I do that for my collegues which may\n> or (usually) may not use git). Making a hook to update the working\n> tree after a push is a terrible hack in git, and just \"hg update\" in\n> Mercurial.\n\nThat's a different issue.  The reason push-into-a-live-tree works that\nway in Hg is because they have this implicit notion of unmerged heads\nthat is merged with the next \"hg update\".  We don't.\n\nInstead, we are more explicit.  If you want to emulate that workflow in\ngit, you would prepare a reception branch, and have people push into it\n(see gitfaq and look for \"sync out of a firewalled host\".  In the FAQ\nentry, pretend as if machineA is such a live work tree you are working\nin, and allow people to push into --- that B/master is the reception\nbranch, although the FAQ entry is about your private use and written as\nif only you from a satellite machine can push into it, it can easily be\na shared branch).\n\nInstead of saying \"hg update\", you (the person working in such a live\nwork tree that allows others to push into) merge that reception branch.\n"},{"id":"61947","messageId":"4755CD32.7040204@gmail.com","threadId":"11133","inReplyTo":"m34peyur8r.fsf@roke.D-201","subject":"Re: [RFC] Introduce .git/BRANCH to point to the current branch","fromName":"Salikh Zakirov","fromEmail":"salikh@gmail.com","sentAt":"2007-12-04T21:57:06Z","receivedAt":"2007-12-04T21:57:06Z","isPatch":false,"sender":{"key":"salikh@gmail.com","avatar":"https://gravatar.com/avatar/952c102bb1dcf721dab8de4f5a11d276756a65d301d021f755e265cc3251efae?d=mp&s=160"},"body":"Jakub Narebski wrote:\n>> Salikh Zakirov <salikh@gmail.com> writes:\n>>> This combination leads to the confusing user experience\n>>> if the branch changes independently of the working directory.\n>>> This can happen in following cases:\n> \n> All those cases are cases of not recommended workflows.\n\nI guess those cases are not recommended exactly because\nthere are prone to causing confusion with current git.\n\nI use multiple workdirs quite often, and by now learned\nnot to check out the same branch in different workdirs, \nbut it would very convenient if it would not be necessary to remember it.\n\n> Please search the archives for idea of BASE extension to index\n> (instead of your separate file under .git/refs), and why it is\n> not in current git.\n\nI never realized this idea has been already tried. Thanks for the pointer!\nI would try to use BASE extension.\n\n> BTW. how in your proposal would you detach HEAD?\n\nDeleting .git/BRANCH should be enough.\nBut I cannot see the workflow that would need it.\nIf one checks out older state of the branch, there is no harm in maintaining\nthe BRANCH pointer, as commits done in this state need to be manually merged in order\nto get into the branch, in the same way as detached head works currently.\n"},{"id":"61949","messageId":"200712042204.lB4M4SVB002260@mi1.bluebottle.com","threadId":"11133","inReplyTo":"7vir3e428i.fsf@gitster.siamese.dyndns.org","subject":"[PATCH] git-checkout --push/--pop","fromName":"Nanako Shiraishi","fromEmail":"nanako3@bluebottle.com","sentAt":"2007-12-04T22:04:06Z","receivedAt":"2007-12-04T22:04:06Z","isPatch":true,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"This introduces a branch-stack mechanism to record branch switching in $GIT_DIR/BRANCH_STACK file.  If you are switching to another branch and plan to come back to the original branch soon, add '--push' option to record your current branch.\nWhen you want to come back, 'git checkout --pop' will switch back to the branch recorded at the top of the stack, while popping it.\n\nSigned-off-by: しらいしななこ <nanako3@bluebottle.com>\n---\n git-checkout.sh |   42 +++++++++++++++++++++++++++++++++++++++++-\n 1 files changed, 41 insertions(+), 1 deletions(-)\n\ndiff --git a/git-checkout.sh b/git-checkout.sh\nindex f6d58ac..b53aea6 100755\n--- a/git-checkout.sh\n+++ b/git-checkout.sh\n@@ -8,8 +8,10 @@ b=          create a new branch started at <branch>\n l           create the new branchs reflog\n track       tells if the new branch should track the remote branch\n f           proceed even if the index or working tree is not HEAD\n-m           performa  three-way merge on local modifications if needed\n+m           perform a three-way merge on local modifications if needed\n q,quiet     be quiet\n+push        push the current branch to branch stack\n+pop         come back to the previous branch by poping from branch stack\n \"\n SUBDIRECTORY_OK=Sometimes\n . git-sh-setup\n@@ -27,6 +29,8 @@ newbranch=\n newbranch_log=\n merge=\n quiet=\n+push=\n+pop=\n v=-v\n LF='\n '\n@@ -49,6 +53,12 @@ while test $# != 0; do\n \t--track|--no-track)\n \t\ttrack=\"$1\"\n \t\t;;\n+\t--push)\n+\t\tpush=1\n+\t\t;;\n+\t--pop)\n+\t\tpop=1\n+\t\t;;\n \t-f)\n \t\tforce=1\n \t\t;;\n@@ -70,6 +80,27 @@ while test $# != 0; do\n \tshift\n done\n \n+if test -n \"$pop\"\n+then\n+\tif test $# != 0\n+\tthen\n+\t\tdie \"git checkout: --pop is incompatible with branch name\"\n+\tfi\n+\tif test -n \"$push\"\n+\tthen\n+\t\tdie \"git checkout: --pop and --push are incompatible\"\n+\tfi\n+\tlast=$(tail -n 1 \"$GIT_DIR/BRANCH_STACK\")\n+\tif test -z \"$last\"\n+\tthen\n+\t\tdie \"git checkout: empty branch stack\"\n+\tfi\n+\tsed -e '$d' <\"$GIT_DIR/BRANCH_STACK\" >\"$GIT_DIR/BRANCH_STACK.new\"\n+\tmv \"$GIT_DIR/BRANCH_STACK.new\" \"$GIT_DIR/BRANCH_STACK\"\n+\tset x \"$last\"\n+\tshift\n+fi\n+\n arg=\"$1\"\n if rev=$(git rev-parse --verify \"$arg^0\" 2>/dev/null)\n then\n@@ -113,6 +144,11 @@ esac\n \n if test \"$#\" -ge 1\n then\n+\t# Checking out a path out of the index or a commit\n+\tif test -n \"$push\"\n+\tthen\n+\t\tdie \"git checkout: --push while not switching branches\"\n+\tfi\n \thint=\n \tif test \"$#\" -eq 1\n \tthen\n@@ -276,6 +312,10 @@ if [ \"$?\" -eq 0 ]; then\n \t\telse\n \t\t\techo >&2 \"Switched to${newbranch:+ a new} branch \\\"$branch\\\"\"\n \t\tfi\n+\t\tif test -n \"$push\"\n+\t\tthen\n+\t\t\techo \"$old_branch_name\" >>\"$GIT_DIR/BRANCH_STACK\"\n+\t\tfi\n \telif test -n \"$detached\"\n \tthen\n \t\told_branch_name=`expr \"z$oldbranch\" : 'zrefs/heads/\\(.*\\)'`\n-- \n1.5.3.6\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n\n----------------------------------------------------------------------\nGet a free email account with anti spam protection.\nhttp://www.bluebottle.com/tag/2\n"},{"id":"61950","messageId":"7v63ze3yiq.fsf@gitster.siamese.dyndns.org","threadId":"11133","inReplyTo":"4755CD32.7040204@gmail.com","subject":"Re: [RFC] Introduce .git/BRANCH to point to the current branch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-12-04T22:06:53Z","receivedAt":"2007-12-04T22:06:53Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Salikh Zakirov <salikh@gmail.com> writes:\n\n> Jakub Narebski wrote:\n> ...\n>> Please search the archives for idea of BASE extension to index\n>> (instead of your separate file under .git/refs), and why it is\n>> not in current git.\n>\n> I never realized this idea has been already tried. Thanks for the pointer!\n> I would try to use BASE extension.\n\nStart reading from here.\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/44360/focus=44508\n\nAll of the articles in that thread is worth a read to understand why the\nidea did not quite pan out and the whole series was reverted.\n\n052737e33a898af8eb4f1bd97be046e05ecb9bea reverts the series from 'next'.\n309202782399878a2d7973e21e6e62ba3b9fde50 was the last of the index-base\nseries.\n"},{"id":"61952","messageId":"200712042308.57048.jnareb@gmail.com","threadId":"11133","inReplyTo":"4755CD32.7040204@gmail.com","subject":"Re: [RFC] Introduce .git/BRANCH to point to the current branch","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-12-04T22:08:55Z","receivedAt":"2007-12-04T22:08:55Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Tue, 4 Dec 2007, Salikh Zakirov wrote:\n> Jakub Narebski wrote:\n>>> Salikh Zakirov <salikh@gmail.com> writes:\n>>>> This combination leads to the confusing user experience\n>>>> if the branch changes independently of the working directory.\n>>>> This can happen in following cases:\n>> \n>> All those cases are cases of not recommended workflows.\n> \n> I guess those cases are not recommended exactly because\n> there are prone to causing confusion with current git.\n\nBTW. I think for each such workflow there is alternative\nin git, which does not cause those problems.\n\n> I use multiple workdirs quite often, and by now learned\n> not to check out the same branch in different workdirs, \n> but it would very convenient if it would not be necessary\n> to remember it. \n\nThose cases are not recommended because they would _always_ cause\nconfusion, whether the user is informed that somehow working copy\nor current branch has changed while he/she was working or not.\nCurrently git tries to follow \"merge when ready\" (i.e. you\nexplicitely ask to merge or rebase), not \"merge when needed\"\n(like in old, broken CVS workflow where 'cvs update' might have\n_forced_ a merge before being allowed to save his/her finished\nwork).\n \n>> BTW. how in your proposal would you detach HEAD?\n> \n> Deleting .git/BRANCH should be enough.\n\nHmmm...\n\n> But I cannot see the workflow that would need it.\n\nChecking out tag. Checking out remote-tracking branch. You cannot\ncommit on top of either (immovable) tag, or (externally controlled) \nremote-tracking branch.\n\nBesides rebase now uses detached HEAD, and I guess that bisect would \ntoo.\n-- \nJakub Narebski\nPoland\n"},{"id":"61972","messageId":"7vprxl1v9v.fsf@gitster.siamese.dyndns.org","threadId":"11133","inReplyTo":"200712042204.lB4M4SVB002260@mi1.bluebottle.com","subject":"Re: [PATCH] git-checkout --push/--pop","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-12-05T06:59:56Z","receivedAt":"2007-12-05T06:59:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nanako Shiraishi <nanako3@bluebottle.com> writes:\n\n> This introduces a branch-stack mechanism to record branch switching in $GIT_DIR/BRANCH_STACK file.  If you are switching to another branch and plan to come back to the original branch soon, add '--push' option to record your current branch.\n> When you want to come back, 'git checkout --pop' will switch back to the branch recorded at the top of the stack, while popping it.\n>\n> Signed-off-by: しらいしななこ <nanako3@bluebottle.com>\n\nHmph, is this in response to my \"I am not sympathtic to 'I have to\nremember'\"?\n\nFunnily enough, I often find myself almost typing pushd/popd when\nswitching branches, so in that sense \"git checkout\" to switch branches\ndoes have some similarity to the notion of pushing and popping.\n\nMatthieu, is this something that forgetful people would find useful?\n\nHaving said that, I think there are other push/pop people wanted from\nyou.  Hint, hint...\n"},{"id":"61994","messageId":"vpqir3de8t6.fsf@bauges.imag.fr","threadId":"11133","inReplyTo":"7vprxl1v9v.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] git-checkout --push/--pop","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-12-05T10:26:45Z","receivedAt":"2007-12-05T10:26:45Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Matthieu, is this something that forgetful people would find useful?\n\nNot sure. That's obviously an interesting feature, but adding two more\noptions to checkout (which is already a huge swiss-army knife) might\nnot be worth the trouble.\n\nAnd the issue with push/pop approaches is that I usually notice I have\nto use pop after not having used push (i.e. I use \"cd -\" all the time,\nbut rarely \"pushd\"/\"popd\").\n\n-- \nMatthieu\n"},{"id":"62042","messageId":"877ijt2g0q.fsf@lysator.liu.se","threadId":"11133","inReplyTo":"vpqir3de8t6.fsf@bauges.imag.fr","subject":"Re: [PATCH] git-checkout --push/--pop","fromName":"David Kågedal","fromEmail":"davidk@lysator.liu.se","sentAt":"2007-12-05T17:44:05Z","receivedAt":"2007-12-05T17:44:05Z","isPatch":true,"sender":{"key":"davidk@lysator.liu.se","avatar":"https://avatars.githubusercontent.com/u/60530?v=4"},"body":"Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Matthieu, is this something that forgetful people would find useful?\n>\n> Not sure. That's obviously an interesting feature, but adding two more\n> options to checkout (which is already a huge swiss-army knife) might\n> not be worth the trouble.\n>\n> And the issue with push/pop approaches is that I usually notice I have\n> to use pop after not having used push (i.e. I use \"cd -\" all the time,\n> but rarely \"pushd\"/\"popd\").\n\nIt is probably more common that you want to be able to switch back to\nthe previous branch, than that you actually need a full stack.\n\nSo a \"git checkout --previous\" could be enough.  Or a set of aliases\n\n[alias]\n\tco = !\"git symbolic-ref HEAD | sed -ne 's!refs/heads/!!p' > .git/LAST ; git checkout\"\n        pop = !\"git co $(cat .git/LAST)\"\n\n-- \nDavid Kågedal\n"},{"id":"62216","messageId":"200712070039.55249.robin.rosenberg.lists@dewire.com","threadId":"11133","inReplyTo":"7vir3e428i.fsf@gitster.siamese.dyndns.org","subject":"Re: [RFC] Introduce .git/BRANCH to point to the current branch","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2007-12-06T23:39:54Z","receivedAt":"2007-12-06T23:39:54Z","isPatch":false,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"tisdag 04 december 2007 skrev Junio C Hamano:\n> Jakub Narebski <jnareb@gmail.com> writes:\n> \n> >> Currently, I can do:\n> >> \n> >> # Oh, what did this look like two commits ago?\n> >> $ git checkout HEAD^^\n> >> # Ah, OK, let's go back to the tip\n> >> $ git checkout branch-name\n> >>                ^^^^^^^^^^^\n> >> But I have to remember and re-type the branch name.\n> >\n> > No, you don't have. You can use\n> >   $ git checkout ORIG_HEAD\n> > or\n> >   $ git checkout HEAD@{1}\n> \n> But the point is he wants to go back to the branch he came from.  He\n> does not want to detach HEAD at the original commit.\n> \n> Having said that, I am not sympathetic to \"I have to remember\".\n\nI abuse git bisect for this temporary switcing. It only gives me a one\nlevel memory, but otoh the git prompt tells me I'm on a discourse.\n\n[me@lathund GIT (rr/abspath|BISECTING)]$ git checkout master\nSwitched to branch \"master\"\n\n[me@lathund GIT (master|BISECTING)]$ git checkout HEAD~2\nNote: moving to \"HEAD~2\" which isn't a local branch\nIf you want to create a new branch from this checkout, you may do so\n(now or later) by using -b with the checkout command again. Example:\n  git checkout -b <new_branch_name>\nHEAD is now at afcc4f7... Merge branch 'js/prune-expire'\n\n[me@lathund GIT (afcc4f7...|BISECTING)]$ git bisect reset\nPrevious HEAD position was afcc4f7... Merge branch 'js/prune-expire'\nSwitched to branch \"rr/abspath\"\n[me@lathund GIT (rr/abspath)]$\n\n-- robin\n"}]}