[git-users] Re: Pissed at Git!
> I see. Well, it would be nice if it gave a little warning. I think I > understand why it happened now though. I was tagging some old versions > that I had failed to do in the past. Not exactly sure how but that > must have been why. I believe the warnings about this have been getting more and more user- friendly - never hurts to have the most recent version of git. (Quick grepping of git.git looks like the last significant change was at the end of January, which was in v1.7.0.) Jeffrey -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To post to this group, send email to git-us...@googlegroups.com. To unsubscribe from this group, send email to git-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/git-users?hl=en.
Re: [git-users] Re: Pissed at Git!
On Wednesday 02 June 2010 10:40:53 Konstantin Khomoutov wrote: > Also, my idea was this: I found myself in situations like this one > being discussed, and my first temptation after finding the relevant > top commit in the reflog always was "tag that immediately, then cool > down, analyse the situation and think", that is, just give that > regained precious commit a name so it's now "referenced". This is always a good policy while you still have training wheels on. Before you do anything too exciting put some sort of tag in place. Then if you get lost it is easier to find where you were before your adventure. You can do the same for rebasing, merging etc. -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To post to this group, send email to git-us...@googlegroups.com. To unsubscribe from this group, send email to git-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/git-users?hl=en.
[git-users] Re: Pissed at Git!
On Jun 2, 1:56 am, Dan Preston wrote: > > Yes. > > Or `git tag recentwork 8658a39`. > > Or `git checkout master && git merge 8658a39`. > > Everything Konstantin said is correct, but I just wanted to add that > git tag will not get you out of the "detached HEAD" state, so you'll > probably want to create a branch, or merge the hash into master > directly, unless the commit really is a special one that you'd like to > tag for easy reference later. I mostly wanted to demonstrate that these hash names are no magic. :-) Also, my idea was this: I found myself in situations like this one being discussed, and my first temptation after finding the relevant top commit in the reflog always was "tag that immediately, then cool down, analyse the situation and think", that is, just give that regained precious commit a name so it's now "referenced". Then if it turns out I really want a branch I can create a branch and get rid of the tag. Or I can just merge the line of development pointed to by that tag to a branch this history is really belongs to and get rid of the tag, too. So it boils down to personal preferences. -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To post to this group, send email to git-us...@googlegroups.com. To unsubscribe from this group, send email to git-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/git-users?hl=en.
Re: [git-users] Re: Pissed at Git!
> Yes. > Or `git tag recentwork 8658a39`. > Or `git checkout master && git merge 8658a39`. Everything Konstantin said is correct, but I just wanted to add that git tag will not get you out of the "detached HEAD" state, so you'll probably want to create a branch, or merge the hash into master directly, unless the commit really is a special one that you'd like to tag for easy reference later. dan On Tue, Jun 1, 2010 at 2:46 PM, Konstantin Khomoutov wrote: > On Jun 2, 1:07 am, Trans wrote: > >> Sorry, make that: >> $ git branch recentwork 8658a39 > > Yes. > Or `git tag recentwork 8658a39`. > Or `git checkout master && git merge 8658a39`. > > In this sense, tag and branch names are just alternative means to > refer to these "true" names of commit objects which are hashes. So you > can use these hash names in any command expecting a branch or a tag > name; that's why Git docs name such things with a common name "commit- > ish". > > -- > You received this message because you are subscribed to the Google Groups > "Git for human beings" group. > To post to this group, send email to git-us...@googlegroups.com. > To unsubscribe from this group, send email to > git-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/git-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To post to this group, send email to git-us...@googlegroups.com. To unsubscribe from this group, send email to git-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/git-users?hl=en.
[git-users] Re: Pissed at Git!
On Jun 2, 1:45 am, Dan Preston wrote: [...] > Yeah, agreed. It's not always immediately obvious. It'll say "Not > currently on any branch." in the git commit message boilerplate as > well as git status output though, so I try to keep my eyes peeled for > that not being the branch I think I'm on. I like to turn on auto > coloring in git config and then it colors that red so I notice it. I > don't remember the config variable offhand but you should be able to > look it up on the git config man page. [...] I use color.ui = auto Looks like that's what you're talking about. This setting basically tries to colorise everything which goes to TTY. -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To post to this group, send email to git-us...@googlegroups.com. To unsubscribe from this group, send email to git-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/git-users?hl=en.
[git-users] Re: Pissed at Git!
On Jun 2, 1:07 am, Trans wrote: > Sorry, make that: > $ git branch recentwork 8658a39 Yes. Or `git tag recentwork 8658a39`. Or `git checkout master && git merge 8658a39`. In this sense, tag and branch names are just alternative means to refer to these "true" names of commit objects which are hashes. So you can use these hash names in any command expecting a branch or a tag name; that's why Git docs name such things with a common name "commit- ish". -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To post to this group, send email to git-us...@googlegroups.com. To unsubscribe from this group, send email to git-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/git-users?hl=en.
Re: [git-users] Re: Pissed at Git!
> $ git branch recentwork 9c51d95 > > And I will have a branch at that point? > Sorry, make that: > > $ git branch recentwork 8658a39 I can honestly never remember what order the branch name and hash go in so I tend to usually use the more longwinded approach. $ git checkout 8658a39 $ git checkout -b recentwork I'm sure it would fail gracefully if you got the order wrong (you probably have it right, I'm just saying), but I just tend to remember this way easier. It is more intuitive to use the branch command to create a branch I would argue though, so maybe you should not learn from my example. :-) > I see. Well, it would be nice if it gave a little warning. I think I > understand why it happened now though. I was tagging some old versions > that I had failed to do in the past. Not exactly sure how but that > must have been why. Yeah, agreed. It's not always immediately obvious. It'll say "Not currently on any branch." in the git commit message boilerplate as well as git status output though, so I try to keep my eyes peeled for that not being the branch I think I'm on. I like to turn on auto coloring in git config and then it colors that red so I notice it. I don't remember the config variable offhand but you should be able to look it up on the git config man page. Not sure why it's not the default setting. I suppose people don't like tools messing with their terminal colors by default? Also with the shell prompt bit from before, you'll notice that your branch is a hash instead of an actual branch name. dan On Tue, Jun 1, 2010 at 2:05 PM, Trans wrote: > > > On Jun 1, 4:39 pm, Dan Preston wrote: >> You should be ok. You can use the "git reflog" command to view the >> history of what you've had checked out. You can then checkout the >> hash commit of your latest work again and create a branch from it. Or >> alternatively you can merge that hash back to master. > > Thank the maker! So the commits are still in there. My reflog reads: > > 9c51d95... h...@{0}: checkout: moving from master to master > 9c51d95... h...@{1}: checkout: moving from html-based to master > 8f1c474... h...@{2}: checkout: moving from master to html-based > 9c51d95... h...@{3}: checkout: moving from > 8658a3910e3ca3b5e66fce6503b42fa431369430 to master > 8658a39... h...@{4}: commit: added multi-pattern matches and evaluator > no longer uses traverse > bb34a07... h...@{5}: commit: admin: add REQUIRE file > 425d22f... h...@{6}: commit: test: add helpers qed test > 958447f... h...@{7}: commit: admin: add roadmap and fix version file > ... > > so I can do: > > $ git branch recentwork 9c51d95 > > And I will have a branch at that point? > >> The (no branch) thing happens when you checkout a hash somewhere in >> your history that isn't associated with any tag or HEAD of a branch. >> If you then begin committing from there, you end up in the situation >> you are in now. It's easy to rectify, but sometimes hard to notice. > > I see. Well, it would be nice if it gave a little warning. I think I > understand why it happened now though. I was tagging some old versions > that I had failed to do in the past. Not exactly sure how but that > must have been why. > >> I insert this into my bash .profile so that the current branch is >> displayed in my terminal prompt. You may find it useful. >> >> # Show the git branch in the prompt >> PS1='[...@\h \W$(__git_ps1 " (%s)")]\$ ' > > I like it. I will use. Thanks. > > -- > You received this message because you are subscribed to the Google Groups > "Git for human beings" group. > To post to this group, send email to git-us...@googlegroups.com. > To unsubscribe from this group, send email to > git-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/git-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To post to this group, send email to git-us...@googlegroups.com. To unsubscribe from this group, send email to git-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/git-users?hl=en.
[git-users] Re: Pissed at Git!
Sorry, make that: $ git branch recentwork 8658a39 -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To post to this group, send email to git-us...@googlegroups.com. To unsubscribe from this group, send email to git-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/git-users?hl=en.
[git-users] Re: Pissed at Git!
On Jun 1, 4:39 pm, Dan Preston wrote: > You should be ok. You can use the "git reflog" command to view the > history of what you've had checked out. You can then checkout the > hash commit of your latest work again and create a branch from it. Or > alternatively you can merge that hash back to master. Thank the maker! So the commits are still in there. My reflog reads: 9c51d95... h...@{0}: checkout: moving from master to master 9c51d95... h...@{1}: checkout: moving from html-based to master 8f1c474... h...@{2}: checkout: moving from master to html-based 9c51d95... h...@{3}: checkout: moving from 8658a3910e3ca3b5e66fce6503b42fa431369430 to master 8658a39... h...@{4}: commit: added multi-pattern matches and evaluator no longer uses traverse bb34a07... h...@{5}: commit: admin: add REQUIRE file 425d22f... h...@{6}: commit: test: add helpers qed test 958447f... h...@{7}: commit: admin: add roadmap and fix version file ... so I can do: $ git branch recentwork 9c51d95 And I will have a branch at that point? > The (no branch) thing happens when you checkout a hash somewhere in > your history that isn't associated with any tag or HEAD of a branch. > If you then begin committing from there, you end up in the situation > you are in now. It's easy to rectify, but sometimes hard to notice. I see. Well, it would be nice if it gave a little warning. I think I understand why it happened now though. I was tagging some old versions that I had failed to do in the past. Not exactly sure how but that must have been why. > I insert this into my bash .profile so that the current branch is > displayed in my terminal prompt. You may find it useful. > > # Show the git branch in the prompt > PS1='[...@\h \W$(__git_ps1 " (%s)")]\$ ' I like it. I will use. Thanks. -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To post to this group, send email to git-us...@googlegroups.com. To unsubscribe from this group, send email to git-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/git-users?hl=en.