* git question: how do I get a specific git version into my working directory? @ 2015-04-18 10:33 Alan Mackenzie 2015-04-18 10:42 ` Andreas Schwab 2015-04-18 12:18 ` Steinar Bang 0 siblings, 2 replies; 17+ messages in thread From: Alan Mackenzie @ 2015-04-18 10:33 UTC (permalink / raw) To: emacs-devel Hello, Emacs. A simple question (I hope): How do I get a specific SW revision into my working directory. I want to do something like this: git <command> 7e09ef09a479731d01b1ca46e94ddadd73ac98e3 . git checkout doesn't seem to be the thing. Neither does git revert. What is <command> here? -- Alan Mackenzie (Nuremberg, Germany). ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: git question: how do I get a specific git version into my working directory? 2015-04-18 10:33 git question: how do I get a specific git version into my working directory? Alan Mackenzie @ 2015-04-18 10:42 ` Andreas Schwab 2015-04-18 12:18 ` Steinar Bang 1 sibling, 0 replies; 17+ messages in thread From: Andreas Schwab @ 2015-04-18 10:42 UTC (permalink / raw) To: Alan Mackenzie; +Cc: emacs-devel Alan Mackenzie <acm@muc.de> writes: > A simple question (I hope): How do I get a specific SW revision into my > working directory. I want to do something like this: > > git <command> 7e09ef09a479731d01b1ca46e94ddadd73ac98e3 > > . git checkout doesn't seem to be the thing. Why do you think so? Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: git question: how do I get a specific git version into my working directory? 2015-04-18 10:33 git question: how do I get a specific git version into my working directory? Alan Mackenzie 2015-04-18 10:42 ` Andreas Schwab @ 2015-04-18 12:18 ` Steinar Bang 2015-04-18 12:42 ` Eli Zaretskii ` (2 more replies) 1 sibling, 3 replies; 17+ messages in thread From: Steinar Bang @ 2015-04-18 12:18 UTC (permalink / raw) To: emacs-devel >>>>> Alan Mackenzie <acm@muc.de>: > Hello, Emacs. > A simple question (I hope): How do I get a specific SW revision into my > working directory. I want to do something like this: > git <command> 7e09ef09a479731d01b1ca46e94ddadd73ac98e3 > git checkout doesn't seem to be the thing. "git checkout 7e09ef09a479731d01b1ca46e94ddadd73ac98e3" should work. What result do you get and what were you expecting? Do you have any uncommitted files it refuses to overwrite? If so, try git stash git checkout 7e09ef09a479731d01b1ca46e94ddadd73ac98e3 git stash pop (don't stash if you have staged files, I think you have uncovered a bug there...) > Neither does git revert. What is <command> here? The command is "checkout". WARNING! Dangeous work-losing command ahead! There is also git reset --hard 7e09ef09a479731d01b1ca46e94ddadd73ac98e3 which will overwrite anything uncommitted and set your workstate to the version described in 7e09ef09a479731d01b1ca46e94ddadd73ac98e3. If you just want to apply that commit, do: git cherry-pick 7e09ef09a479731d01b1ca46e94ddadd73ac98e3 ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: git question: how do I get a specific git version into my working directory? 2015-04-18 12:18 ` Steinar Bang @ 2015-04-18 12:42 ` Eli Zaretskii 2015-04-18 13:16 ` Alan Mackenzie 2015-04-18 12:48 ` Eric Abrahamsen 2015-04-18 13:09 ` Alan Mackenzie 2 siblings, 1 reply; 17+ messages in thread From: Eli Zaretskii @ 2015-04-18 12:42 UTC (permalink / raw) To: Steinar Bang; +Cc: emacs-devel > From: Steinar Bang <sb@dod.no> > Date: Sat, 18 Apr 2015 14:18:59 +0200 > > >>>>> Alan Mackenzie <acm@muc.de>: > > > Hello, Emacs. > > A simple question (I hope): How do I get a specific SW revision into my > > working directory. I want to do something like this: > > > git <command> 7e09ef09a479731d01b1ca46e94ddadd73ac98e3 > > > git checkout doesn't seem to be the thing. > > "git checkout 7e09ef09a479731d01b1ca46e94ddadd73ac98e3" should work. It also creates a "detached HEAD", so Alan should IMO be aware of that, and return to the upstream head ASAP (or, better, do all of this in a separate branch to begin with). ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: git question: how do I get a specific git version into my working directory? 2015-04-18 12:42 ` Eli Zaretskii @ 2015-04-18 13:16 ` Alan Mackenzie 2015-04-18 13:20 ` Dmitry Gutov 2015-04-18 13:37 ` Eli Zaretskii 0 siblings, 2 replies; 17+ messages in thread From: Alan Mackenzie @ 2015-04-18 13:16 UTC (permalink / raw) To: Eli Zaretskii; +Cc: emacs-devel Hello, Eli. On Sat, Apr 18, 2015 at 03:42:42PM +0300, Eli Zaretskii wrote: > > From: Steinar Bang <sb@dod.no> > > Date: Sat, 18 Apr 2015 14:18:59 +0200 > > >>>>> Alan Mackenzie <acm@muc.de>: > > > Hello, Emacs. > > > A simple question (I hope): How do I get a specific SW revision into my > > > working directory. I want to do something like this: > > > git <command> 7e09ef09a479731d01b1ca46e94ddadd73ac98e3 > > > git checkout doesn't seem to be the thing. > > "git checkout 7e09ef09a479731d01b1ca46e94ddadd73ac98e3" should work. > It also creates a "detached HEAD", so Alan should IMO be aware of > that, and return to the upstream head ASAP (or, better, do all of this > in a separate branch to begin with). I'm aware of it, now! Given that I'm not intending to do any VCS operation on this, other than "git checkout <revision number>", I should be all right, surely? I'm expecting (?hoping) that on switching back to the HEAD revision, the detached head (?all detached heads) will vanish. -- Alan Mackenzie (Nuremberg, Germany). ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: git question: how do I get a specific git version into my working directory? 2015-04-18 13:16 ` Alan Mackenzie @ 2015-04-18 13:20 ` Dmitry Gutov 2015-04-18 13:37 ` Eli Zaretskii 1 sibling, 0 replies; 17+ messages in thread From: Dmitry Gutov @ 2015-04-18 13:20 UTC (permalink / raw) To: Alan Mackenzie, Eli Zaretskii; +Cc: emacs-devel On 04/18/2015 04:16 PM, Alan Mackenzie wrote: > I'm aware of it, now! Given that I'm not intending to do any VCS > operation on this, other than "git checkout <revision number>", I should > be all right, surely? I'm expecting (?hoping) that on switching back to > the HEAD revision, the detached head (?all detached heads) will vanish. You'll have to switch back to a specific branch. Switching to HEAD is a no-op. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: git question: how do I get a specific git version into my working directory? 2015-04-18 13:16 ` Alan Mackenzie 2015-04-18 13:20 ` Dmitry Gutov @ 2015-04-18 13:37 ` Eli Zaretskii 2015-04-18 14:07 ` Harald Hanche-Olsen 1 sibling, 1 reply; 17+ messages in thread From: Eli Zaretskii @ 2015-04-18 13:37 UTC (permalink / raw) To: Alan Mackenzie; +Cc: emacs-devel > Date: Sat, 18 Apr 2015 13:16:07 +0000 > From: Alan Mackenzie <acm@muc.de> > Cc: emacs-devel@gnu.org > > > > "git checkout 7e09ef09a479731d01b1ca46e94ddadd73ac98e3" should work. > > > It also creates a "detached HEAD", so Alan should IMO be aware of > > that, and return to the upstream head ASAP (or, better, do all of this > > in a separate branch to begin with). > > I'm aware of it, now! Given that I'm not intending to do any VCS > operation on this, other than "git checkout <revision number>", I should > be all right, surely? I'm expecting (?hoping) that on switching back to > the HEAD revision, the detached head (?all detached heads) will vanish. If I were you, I'd do all this in a separate branch, just to be sure my 'master' branch had no chance whatsoever to be affected. Then you could simply delete that branch when no longer needed. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: git question: how do I get a specific git version into my working directory? 2015-04-18 13:37 ` Eli Zaretskii @ 2015-04-18 14:07 ` Harald Hanche-Olsen 2015-04-18 14:43 ` Eli Zaretskii 0 siblings, 1 reply; 17+ messages in thread From: Harald Hanche-Olsen @ 2015-04-18 14:07 UTC (permalink / raw) To: Eli Zaretskii; +Cc: Alan Mackenzie, emacs-devel Eli Zaretskii wrote: > If I were you, I'd do all this in a separate branch, just to be sure > my 'master' branch had no chance whatsoever to be affected. Then you > could simply delete that branch when no longer needed. Since the master branch is just a pointer into some specific commit, I don't think anything you do while in a headless commit can affect the master branch in any way. (Unless, of course, you run commands that specifically name the master branch in order to change it.) To get to the master branch just as it was, run “git checkout master”. If you made changes while in the headless commit, that will fail. In which case, either abandon the changes with “git checkout -f master”, or stash them first. – Harald ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: git question: how do I get a specific git version into my working directory? 2015-04-18 14:07 ` Harald Hanche-Olsen @ 2015-04-18 14:43 ` Eli Zaretskii 2015-04-18 17:09 ` Stefan Monnier 0 siblings, 1 reply; 17+ messages in thread From: Eli Zaretskii @ 2015-04-18 14:43 UTC (permalink / raw) To: Harald Hanche-Olsen; +Cc: acm, emacs-devel > Date: Sat, 18 Apr 2015 16:07:44 +0200 > From: Harald Hanche-Olsen <hanche@math.ntnu.no> > Cc: Alan Mackenzie <acm@muc.de>, emacs-devel@gnu.org > > Eli Zaretskii wrote: > > If I were you, I'd do all this in a separate branch, just to be sure > > my 'master' branch had no chance whatsoever to be affected. Then you > > could simply delete that branch when no longer needed. > > Since the master branch is just a pointer into some specific commit, I > don't think anything you do while in a headless commit can affect the > master branch in any way. (Unless, of course, you run commands that > specifically name the master branch in order to change it.) > > To get to the master branch just as it was, run “git checkout master”. > > If you made changes while in the headless commit, that will fail. In > which case, either abandon the changes with “git checkout -f master”, or > stash them first. Yes, I know all that. But I'd still do all that on a separate branch, since 'master' is not supposed to be used for such stuff, it's supposed to track upstream as close as possible. Better be safe than sorry. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: git question: how do I get a specific git version into my working directory? 2015-04-18 14:43 ` Eli Zaretskii @ 2015-04-18 17:09 ` Stefan Monnier 2015-04-18 17:37 ` Eli Zaretskii 0 siblings, 1 reply; 17+ messages in thread From: Stefan Monnier @ 2015-04-18 17:09 UTC (permalink / raw) To: Eli Zaretskii; +Cc: acm, Harald Hanche-Olsen, emacs-devel > Yes, I know all that. But I'd still do all that on a separate branch, > since 'master' is not supposed to be used for such stuff, it's > supposed to track upstream as close as possible. I think Harald's point is that after "git checkout e56ab7" you're simply not in "master" any more. At least, not more than you're in any other branch. Instead, you're in a kind of transient nameless branch. Stefan ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: git question: how do I get a specific git version into my working directory? 2015-04-18 17:09 ` Stefan Monnier @ 2015-04-18 17:37 ` Eli Zaretskii 2015-04-18 17:44 ` Harald Hanche-Olsen 0 siblings, 1 reply; 17+ messages in thread From: Eli Zaretskii @ 2015-04-18 17:37 UTC (permalink / raw) To: Stefan Monnier; +Cc: acm, hanche, emacs-devel > From: Stefan Monnier <monnier@IRO.UMontreal.CA> > Date: Sat, 18 Apr 2015 13:09:01 -0400 > Cc: acm@muc.de, Harald Hanche-Olsen <hanche@math.ntnu.no>, emacs-devel@gnu.org > > > Yes, I know all that. But I'd still do all that on a separate branch, > > since 'master' is not supposed to be used for such stuff, it's > > supposed to track upstream as close as possible. > > I think Harald's point is that after "git checkout e56ab7" you're simply > not in "master" any more. At least, not more than you're in any > other branch. Instead, you're in a kind of transient nameless branch. And my point is: why have a nameless branch, if you can have a named one? ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: git question: how do I get a specific git version into my working directory? 2015-04-18 17:37 ` Eli Zaretskii @ 2015-04-18 17:44 ` Harald Hanche-Olsen 0 siblings, 0 replies; 17+ messages in thread From: Harald Hanche-Olsen @ 2015-04-18 17:44 UTC (permalink / raw) To: Eli Zaretskii; +Cc: acm, Stefan Monnier, emacs-devel Eli Zaretskii wrote: >> From: Stefan Monnier<monnier@IRO.UMontreal.CA> >> Date: Sat, 18 Apr 2015 13:09:01 -0400 >> Cc: acm@muc.de, Harald Hanche-Olsen<hanche@math.ntnu.no>, emacs-devel@gnu.org >> >>> Yes, I know all that. But I'd still do all that on a separate branch, >>> since 'master' is not supposed to be used for such stuff, it's >>> supposed to track upstream as close as possible. >> I think Harald's point is that after "git checkout e56ab7" you're simply >> not in "master" any more. At least, not more than you're in any >> other branch. That's my point, yes. >> Instead, you're in a kind of transient nameless branch. Well, not even that. Branches by definition have names: A branch is a name which (a) points to a commit, (b) moves to a newly created commit when you check in code, and optionally (c) has remote-tracking behaviour. > And my point is: why have a nameless branch, if you can have a named > one? That's a good point, but the reason for it is not any danger of messing up the master branch. Rather, it is the danger of messing up any code you write while in the detached state. – Harald ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: git question: how do I get a specific git version into my working directory? 2015-04-18 12:18 ` Steinar Bang 2015-04-18 12:42 ` Eli Zaretskii @ 2015-04-18 12:48 ` Eric Abrahamsen 2015-04-18 13:09 ` Alan Mackenzie 2 siblings, 0 replies; 17+ messages in thread From: Eric Abrahamsen @ 2015-04-18 12:48 UTC (permalink / raw) To: emacs-devel Steinar Bang <sb@dod.no> writes: >>>>>> Alan Mackenzie <acm@muc.de>: > >> Hello, Emacs. >> A simple question (I hope): How do I get a specific SW revision into my >> working directory. I want to do something like this: > >> git <command> 7e09ef09a479731d01b1ca46e94ddadd73ac98e3 > >> git checkout doesn't seem to be the thing. > > "git checkout 7e09ef09a479731d01b1ca46e94ddadd73ac98e3" should work. > > What result do you get and what were you expecting? Do you have any > uncommitted files it refuses to overwrite? If so, try > git stash > git checkout 7e09ef09a479731d01b1ca46e94ddadd73ac98e3 > git stash pop > > (don't stash if you have staged files, I think you have uncovered a bug > there...) > >> Neither does git revert. What is <command> here? > > The command is "checkout". > > WARNING! Dangeous work-losing command ahead! > There is also > git reset --hard 7e09ef09a479731d01b1ca46e94ddadd73ac98e3 > which will overwrite anything uncommitted and set your workstate to the > version described in 7e09ef09a479731d01b1ca46e94ddadd73ac98e3. > > If you just want to apply that commit, do: > git cherry-pick 7e09ef09a479731d01b1ca46e94ddadd73ac98e3 I think the recommended approach is to create a branch pointing at a specific commit. So: git checkout -b test_branch 7e09ef09 Otherwise you're in a "detached head" state, which can have odd results. The branch method is at least a little more stable. Eric ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: git question: how do I get a specific git version into my working directory? 2015-04-18 12:18 ` Steinar Bang 2015-04-18 12:42 ` Eli Zaretskii 2015-04-18 12:48 ` Eric Abrahamsen @ 2015-04-18 13:09 ` Alan Mackenzie 2015-04-18 13:18 ` Dmitry Gutov ` (2 more replies) 2 siblings, 3 replies; 17+ messages in thread From: Alan Mackenzie @ 2015-04-18 13:09 UTC (permalink / raw) To: emacs-devel Hello, Steinar. On Sat, Apr 18, 2015 at 02:18:59PM +0200, Steinar Bang wrote: > >>>>> Alan Mackenzie <acm@muc.de>: > > Hello, Emacs. > > A simple question (I hope): How do I get a specific SW revision into my > > working directory. I want to do something like this: > > git <command> 7e09ef09a479731d01b1ca46e94ddadd73ac98e3 > > git checkout doesn't seem to be the thing. > "git checkout 7e09ef09a479731d01b1ca46e94ddadd73ac98e3" should work. > What result do you get and what were you expecting? Do you have any > uncommitted files it refuses to overwrite? If so, try > git stash > git checkout 7e09ef09a479731d01b1ca46e94ddadd73ac98e3 > git stash pop > (don't stash if you have staged files, I think you have uncovered a bug > there...) No, I hadn't tried the command. I have now, and it "seems to work". > > Neither does git revert. What is <command> here? > The command is "checkout". Thanks! > WARNING! Dangeous work-losing command ahead! > There is also > git reset --hard 7e09ef09a479731d01b1ca46e94ddadd73ac98e3 > which will overwrite anything uncommitted and set your workstate to the > version described in 7e09ef09a479731d01b1ca46e94ddadd73ac98e3. > If you just want to apply that commit, do: > git cherry-pick 7e09ef09a479731d01b1ca46e94ddadd73ac98e3 I am doing a bisect: a bisect where I only want revisions taken into account when specific files have been modified. -- Alan Mackenzie (Nuremberg, Germany). ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: git question: how do I get a specific git version into my working directory? 2015-04-18 13:09 ` Alan Mackenzie @ 2015-04-18 13:18 ` Dmitry Gutov 2015-04-18 13:57 ` Steinar Bang 2015-04-18 14:03 ` Andreas Schwab 2 siblings, 0 replies; 17+ messages in thread From: Dmitry Gutov @ 2015-04-18 13:18 UTC (permalink / raw) To: Alan Mackenzie, emacs-devel On 04/18/2015 04:09 PM, Alan Mackenzie wrote: > I am doing a bisect: a bisect where I only want revisions taken into > account when specific files have been modified. Have you tried passing those file paths after "git bisect start --"? http://stackoverflow.com/questions/3179498/how-can-i-cut-down-a-git-bisect-run-using-file-paths ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: git question: how do I get a specific git version into my working directory? 2015-04-18 13:09 ` Alan Mackenzie 2015-04-18 13:18 ` Dmitry Gutov @ 2015-04-18 13:57 ` Steinar Bang 2015-04-18 14:03 ` Andreas Schwab 2 siblings, 0 replies; 17+ messages in thread From: Steinar Bang @ 2015-04-18 13:57 UTC (permalink / raw) To: emacs-devel >>>>> Alan Mackenzie <acm@muc.de>: > I am doing a bisect: a bisect where I only want revisions taken into > account when specific files have been modified. Hm... when I do bisect I just to "git bisect" and feed it the two sha1 hashes it should bisect between, and it has so far done its magic to my satisfaction (ie. if it was caused by a commit, I have successfully identified a particular commit where the issue starts). After that I usually branch off from the commit before the offending commit and stay there until things are resolved (unless I'm able to resolve it myself). Or I branch off master and revert the offending commit until things are resolved, ie. like so git checkout master git checkout -b sb-master git revert sha1-of-offending-commit (that's what I did with gnus, when cram-md5 auth disappeared from nnimap with SSL/TLS...) ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: git question: how do I get a specific git version into my working directory? 2015-04-18 13:09 ` Alan Mackenzie 2015-04-18 13:18 ` Dmitry Gutov 2015-04-18 13:57 ` Steinar Bang @ 2015-04-18 14:03 ` Andreas Schwab 2 siblings, 0 replies; 17+ messages in thread From: Andreas Schwab @ 2015-04-18 14:03 UTC (permalink / raw) To: Alan Mackenzie; +Cc: emacs-devel Alan Mackenzie <acm@muc.de> writes: > I am doing a bisect: a bisect where I only want revisions taken into > account when specific files have been modified. A typical XY problem. http://www.perlmonks.org/?node=542341 Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2015-04-18 17:44 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-04-18 10:33 git question: how do I get a specific git version into my working directory? Alan Mackenzie 2015-04-18 10:42 ` Andreas Schwab 2015-04-18 12:18 ` Steinar Bang 2015-04-18 12:42 ` Eli Zaretskii 2015-04-18 13:16 ` Alan Mackenzie 2015-04-18 13:20 ` Dmitry Gutov 2015-04-18 13:37 ` Eli Zaretskii 2015-04-18 14:07 ` Harald Hanche-Olsen 2015-04-18 14:43 ` Eli Zaretskii 2015-04-18 17:09 ` Stefan Monnier 2015-04-18 17:37 ` Eli Zaretskii 2015-04-18 17:44 ` Harald Hanche-Olsen 2015-04-18 12:48 ` Eric Abrahamsen 2015-04-18 13:09 ` Alan Mackenzie 2015-04-18 13:18 ` Dmitry Gutov 2015-04-18 13:57 ` Steinar Bang 2015-04-18 14:03 ` Andreas Schwab
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.