I don't understand how to see a branch's changes.
I updated a clone of opensmalltalk-vm and switched to John's JMM/SleepTime branch: McStalker.oscogvm.clean$ git pull -a Already up-to-date. McStalker.oscogvm.clean$ git checkout -b JMM/SleepTime Switched to a new branch 'JMM/SleepTime' McStalker.oscogvm.clean$ git status On branch JMM/SleepTime nothing to commit, working tree clean then I searched for the code, of which there was no sign: McStalker.oscogvm.clean$ find platforms/iOS -type f -exec grep -H 'receive[A-Za-z]*Note' {} \; McStalker.oscogvm.clean$ diff platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m ~/oscogvm/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m What gives? I'm on John's branch but I don't see his modifications. _,,,^..^,,,_ best, Eliot |
Hi Eliot: > On 22 Mar 2017, at 21:47, Eliot Miranda <[hidden email]> wrote: > > I don't understand how to see a branch's changes. > > I updated a clone of opensmalltalk-vm and switched to John's JMM/SleepTime branch: > > McStalker.oscogvm.clean$ git pull -a > Already up-to-date. > McStalker.oscogvm.clean$ git checkout -b JMM/SleepTime This looks wrong. That’s just creating a fresh branch, no? You’ll probably need some variant of: git checkout -b JMM/SleepTime origin/JMM/SleepTime `git log` should then also be a better way to check whether you’re on the branch you expect. Best regards Stefan -- Stefan Marr Johannes Kepler Universität Linz http://stefan-marr.de/research/ |
Hi Stefan,
On Wed, Mar 22, 2017 at 2:10 PM, Stefan Marr <[hidden email]> wrote:
So now I'm in this state: McStalker.oscogvm.clean$ git status On branch Cog Your branch is up-to-date with 'origin/Cog'. nothing to commit, working tree clean What do I type to get to John's changes?
_,,,^..^,,,_ best, Eliot |
> On 22.03.2017, at 22:33, Eliot Miranda <[hidden email]> wrote: > > Hi Stefan, > > On Wed, Mar 22, 2017 at 2:10 PM, Stefan Marr <[hidden email]> wrote: > > Hi Eliot: > >> On 22 Mar 2017, at 21:47, Eliot Miranda <[hidden email]> wrote: >> >> I don't understand how to see a branch's changes. >> >> I updated a clone of opensmalltalk-vm and switched to John's JMM/SleepTime branch: >> >> McStalker.oscogvm.clean$ git pull -a >> Already up-to-date. >> McStalker.oscogvm.clean$ git checkout -b JMM/SleepTime > > This looks wrong. > That’s just creating a fresh branch, no? > > You’ll probably need some variant of: git checkout -b JMM/SleepTime origin/JMM/SleepTime > > `git log` should then also be a better way to check whether you’re on the branch you expect. > > So now I'm in this state: > > McStalker.oscogvm.clean$ git status > On branch Cog > Your branch is up-to-date with 'origin/Cog'. > nothing to commit, working tree clean > > What do I type to get to John's changes? git diff JMM/SleepTime ? > > > Best regards > Stefan > > > -- > Stefan Marr > Johannes Kepler Universität Linz > http://stefan-marr.de/research/ > > > > > > > -- > _,,,^..^,,,_ > best, Eliot |
On Wed, Mar 22, 2017 at 2:34 PM, Tobias Pape <[hidden email]> wrote:
What do I type to see John's changes materialised in the relevant files in my repository? I don't want to copy/paste his changes :-/
_,,,^..^,,,_ best, Eliot |
In reply to this post by Tobias Pape
On Wed, Mar 22, 2017 at 2:34 PM, Tobias Pape <[hidden email]> wrote:
Oh, and... McStalker.oscogvm.clean$ git checkout CogSwitched to branch 'Cog' Your branch is up-to-date with 'origin/Cog'. /Users/eliot/oscogvm.clean /Users/eliot/oscogvm.clean /Users/eliot/oscogvm.clean No stash found. McStalker.oscogvm.clean$ git diff JMM/SleepTime McStalker.oscogvm.clean$ git -version Unknown option: -version usage: git [--version] [--help] [-C <path>] [-c name=value] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path] [-p | --paginate | --no-pager] [--no-replace-objects] [--bare] [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>] <command> [<args>] McStalker.oscogvm.clean$ git --version git version 2.10.0 McStalker.oscogvm.clean$ This system takes version control to a new level. "We don't need no stinkin' changes!"
_,,,^..^,,,_ best, Eliot |
In reply to this post by Eliot Miranda-2
2017-03-22 22:10 GMT+01:00 Stefan Marr <[hidden email]>: > > `git log` should then also be a better way to check whether you’re on the branch you expect. > Also note the --decorate flag of git log, which adds labels for branches and tags, like graphical tools such as gitk or SourceTree do. For that matter, there is also --graph. 2017-03-22 21:47 GMT+01:00 Eliot Miranda <[hidden email]>: > McStalker.oscogvm.clean$ git pull -a I think -a might not do what you want, either. For pull, it is short for --append and related to the FETCH_HEAD file. If you just want to download branches and not merge anything into your current branch, you should use git fetch instead of pull (pull = fetch&&merge). In case you thought that -a means "--all": git pull --all does fetch from all remote repositories, but would still attempt to merge the upstream of your current branch. Kind regards, Jakob |
In reply to this post by Eliot Miranda-2
> On 22.03.2017, at 22:36, Eliot Miranda <[hidden email]> wrote: > > > > On Wed, Mar 22, 2017 at 2:34 PM, Tobias Pape <[hidden email]> wrote: > > > > On 22.03.2017, at 22:33, Eliot Miranda <[hidden email]> wrote: > > > > Hi Stefan, > > > > On Wed, Mar 22, 2017 at 2:10 PM, Stefan Marr <[hidden email]> wrote: > > > > Hi Eliot: > > > >> On 22 Mar 2017, at 21:47, Eliot Miranda <[hidden email]> wrote: > >> > >> I don't understand how to see a branch's changes. > >> > >> I updated a clone of opensmalltalk-vm and switched to John's JMM/SleepTime branch: > >> > >> McStalker.oscogvm.clean$ git pull -a > >> Already up-to-date. > >> McStalker.oscogvm.clean$ git checkout -b JMM/SleepTime > > > > This looks wrong. > > That’s just creating a fresh branch, no? > > > > You’ll probably need some variant of: git checkout -b JMM/SleepTime origin/JMM/SleepTime > > > > `git log` should then also be a better way to check whether you’re on the branch you expect. > > > > So now I'm in this state: > > > > McStalker.oscogvm.clean$ git status > > On branch Cog > > Your branch is up-to-date with 'origin/Cog'. > > nothing to commit, working tree clean > > > > What do I type to get to John's changes? > > git diff JMM/SleepTime > > What do I type to see John's changes materialised in the relevant files in my repository? I don't want to copy/paste his changes :-/ I don't get it right away. Do you want Johns changes applied to your branch? git merge JMM/SleepTime (Or if you don't want to commit right away: git merge --no-commit JMM/SleepTime Do you want to see the general commit information of John's commit? git log ..JMM/SleepTime Do you want to see the difference between Cog and JMM/SleepTime ? git diff JMM/SleepTime # if you are on 'Cog' and previously did 'git checkout JMM/SleepTime' git diff Cog..origin/JMM/SleepTime # otherwise Best regards -Tobias > > > ? > > > > > > Best regards > > Stefan > > > > > > -- > > Stefan Marr > > Johannes Kepler Universität Linz > > http://stefan-marr.de/research/ > > > > > > > > > > > > > > -- > > _,,,^..^,,,_ > > best, Eliot > > > > > -- > _,,,^..^,,,_ > best, Eliot |
In reply to this post by Eliot Miranda-2
Hi Eliot: > On 22 Mar 2017, at 22:36, Eliot Miranda <[hidden email]> wrote: > > What do I type to see John's changes materialised in the relevant files in my repository? I don’t want to copy/paste his changes :-/ ~/tmp/opensmalltalk-vm$ git fetch remote: Counting objects: 6, done. remote: Compressing objects: 100% (6/6), done. remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (6/6), done. From https://github.com/OpenSmalltalk/opensmalltalk-vm ce673d0a6..b076561ab Cog -> origin/Cog ~/tmp/opensmalltalk-vm$ git checkout -b JMM/SleepTime origin/JMM/SleepTime Checking out files: 100% (57/57), done. Branch JMM/SleepTime set up to track remote branch JMM/SleepTime from origin. Switched to a new branch 'JMM/SleepTime' ~/tmp/opensmalltalk-vm$ git --no-pager log -n2 commit f829fb66db403a05fe0360b17a81ea5095504fbd Author: johnmci <[hidden email]> Date: Tue Mar 21 17:13:50 2017 -0700 Add logic to test the ability to get the sleep/wake time notifications so we can adjust idle time for the VM commit 54bab0a7a2901d70719715625150a95ef2ab7784 Author: Eliot Miranda <[hidden email]> Date: Tue Mar 21 08:44:09 2017 -0700 Linux (& unix/Mac OS X): Fix the build of the XDisplayControlPlugin on linuxes where .so is not appended to shared objects. Fix the language in sqUnixHeartbeat.c and add more information. Make the code exclusive to linux, and use exeName instead of a hardwired name. Personally, I use Git Tower, or Git Kraken. I prefer to see stuff, without having to explicitly invoke commands. Best regards Stefan -- Stefan Marr Johannes Kepler Universität Linz http://stefan-marr.de/research/ |
In reply to this post by Tobias Pape
Hi Tobias,
On Wed, Mar 22, 2017 at 2:54 PM, Tobias Pape <[hidden email]> wrote:
I want tio checkout the latest committed version of John's branch without merging. Preferably I want to be able to do that from a dirty state on another branch such that IU can switch back to that dirty state.
_,,,^..^,,,_ best, Eliot |
> On 22.03.2017, at 23:04, Eliot Miranda <[hidden email]> wrote: > > Hi Tobias, > > On Wed, Mar 22, 2017 at 2:54 PM, Tobias Pape <[hidden email]> wrote: > > > > On 22.03.2017, at 22:36, Eliot Miranda <[hidden email]> wrote: > > > > > > > > On Wed, Mar 22, 2017 at 2:34 PM, Tobias Pape <[hidden email]> wrote: > > > > > > > On 22.03.2017, at 22:33, Eliot Miranda <[hidden email]> wrote: > > > > > > Hi Stefan, > > > > > > On Wed, Mar 22, 2017 at 2:10 PM, Stefan Marr <[hidden email]> wrote: > > > > > > Hi Eliot: > > > > > >> On 22 Mar 2017, at 21:47, Eliot Miranda <[hidden email]> wrote: > > >> > > >> I don't understand how to see a branch's changes. > > >> > > >> I updated a clone of opensmalltalk-vm and switched to John's JMM/SleepTime branch: > > >> > > >> McStalker.oscogvm.clean$ git pull -a > > >> Already up-to-date. > > >> McStalker.oscogvm.clean$ git checkout -b JMM/SleepTime > > > > > > This looks wrong. > > > That’s just creating a fresh branch, no? > > > > > > You’ll probably need some variant of: git checkout -b JMM/SleepTime origin/JMM/SleepTime > > > > > > `git log` should then also be a better way to check whether you’re on the branch you expect. > > > > > > So now I'm in this state: > > > > > > McStalker.oscogvm.clean$ git status > > > On branch Cog > > > Your branch is up-to-date with 'origin/Cog'. > > > nothing to commit, working tree clean > > > > > > What do I type to get to John's changes? > > > > git diff JMM/SleepTime > > > > What do I type to see John's changes materialised in the relevant files in my repository? I don't want to copy/paste his changes :-/ > > I don't get it right away. > Do you want Johns changes applied to your branch? > > git merge JMM/SleepTime > > (Or if you don't want to commit right away: > > git merge --no-commit JMM/SleepTime > > Do you want to see the general commit information of John's commit? > > git log ..JMM/SleepTime > > Do you want to see the difference between Cog and JMM/SleepTime ? > > git diff JMM/SleepTime # if you are on 'Cog' and previously did 'git checkout JMM/SleepTime' > git diff Cog..origin/JMM/SleepTime # otherwise > > I want tio checkout the latest committed version of John's branch without merging. Preferably I want to be able to do that from a dirty state on another branch such that IU can switch back to that dirty state. $ git status # shows some Ms $ git stash # put away changed things $ git status # shows no Ms $ git checkout JMM/SleepTime # should be equivalent to 'git checkout -b JMM/SleepTime origin/JMM/SleepTime' # you are now on Johns branch. What is the difference to cog? $ git diff Cog # what are the latest changes on this branch briefly? $ git log # ok, I'm done, back to Cog $ git checkout Cog # Maybe merge John's code $ git merge JMM/SleepTime # creates commit # get back the put away things $ git stash pop Best regards -Tobias > > > Best regards > -Tobias > > > > > > > ? > > > > > > > > > Best regards > > > Stefan > > > > > > > > > -- > > > Stefan Marr > > > Johannes Kepler Universität Linz > > > http://stefan-marr.de/research/ > > > > > > > > > > > > > > > > > > > > > -- > > > _,,,^..^,,,_ > > > best, Eliot > > > > > > > > > > -- > > _,,,^..^,,,_ > > best, Eliot > > > > > -- > _,,,^..^,,,_ > best, Eliot |
Hi Tobias,
On Wed, Mar 22, 2017 at 3:16 PM, Tobias Pape <[hidden email]> wrote:
thank you. Fab. This is what I want (& it works). Now one more thing... How do I cherry-pick? Can I merge only certain changes from a branch? Or do I have to merge and revert/checkout the changes I don't want? e.g. is something like this possible? git merge JMM/SleepTime:platforms/iOS/vm/OSX/{SqueakOSXAppDelegate.m,sqSqueakOSXApplication.m}
_,,,^..^,,,_ best, Eliot |
In reply to this post by Tobias Pape
You can cherry-pick whole commits with git cherry-pick. If you only want some files or a directory from a specific commit, use git checkout <commit or branch> -- <list of file paths> then git add and git commit them as usual. 2017-03-22 23:59 GMT+01:00 Eliot Miranda <[hidden email]>: > |
...or if you wanted to pick most of the changes from a commit or branch, but reject individual files: git cherry-pick <commit> --no-commit - or - git merge <branch> --no-commit then (probably after git status): git checkout HEAD -- <list of paths> to discard the changes to these files. Then git commit to store your partial merge/cherry-pick. 2017-03-23 0:07 GMT+01:00 Jakob Reschke <[hidden email]>: > You can cherry-pick whole commits with git cherry-pick. > > If you only want some files or a directory from a specific commit, use > > git checkout <commit or branch> -- <list of file paths> > > then git add and git commit them as usual. > > 2017-03-22 23:59 GMT+01:00 Eliot Miranda <[hidden email]>: >> |
In reply to this post by Eliot Miranda-2
On Thu, Mar 23, 2017 at 4:47 AM, Eliot Miranda <[hidden email]> wrote: > > I don't understand how to see a branch's changes. > > I updated a clone of opensmalltalk-vm and switched to John's JMM/SleepTime branch: > > McStalker.oscogvm.clean$ git pull -a > Already up-to-date. > McStalker.oscogvm.clean$ git checkout -b JMM/SleepTime > Switched to a new branch 'JMM/SleepTime' As someone Stefan said, the "-b" creates a new branch, as the response also advises. That command should have said "fatal: A branch named 'JMM/SleepTime' already exists" which implies that that branch was not in your local repository. > McStalker.oscogvm.clean$ git status > On branch JMM/SleepTime > nothing to commit, working tree clean If you were previously in a clean "Cog" branch, then nothing has changed in your working directory. Per the "-b" you just created a branch tag "JMM/SleepTime" pointing at the same commit as "Cog." > > then I searched for the code, of which there was no sign: > > McStalker.oscogvm.clean$ find platforms/iOS -type f -exec grep -H 'receive[A-Za-z]*Note' {} \; > McStalker.oscogvm.clean$ diff platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m ~/oscogvm/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m > > What gives? I'm on John's branch but I don't see his modifications. You are not on his branch. Just a branch with the same name. Just check what branches you have in case something was misspelt. $ git banch -vv Now to recover, first you should delete that branch you created locally. $ git checkout Cog $ git branch -d JMM/SleepTime Now I'm going to advocate that you don't use "git pull" and instead separately use "git fetch && git merge". "git pull" essentially rolls both those into one, which is efficient by a few keystrokes, but you lose the cognitive understanding of what is going on. As described at [1] "[The] nice point about fetching and merging separately [is] it gives you the chance to examine what you’ve fetched before deciding what to do next. Also, by doing this separately the distinction between when you should use a local branch name and a remote-tracking branch name becomes clear very quickly." I think that last point is particularly important when you've come from a subversion background. Possibly even though you've found a daily workflow with git, how you "think" about repositories is probably still heavily biased by your long subversion usage. I actually find the topic "remote-tracking" branches mildly confusing when it generically refer to "origin/master". I find it much easier to understand by concretely renaming origin to its github remote name. So please humour me and try this... $ git remote -v $ git remote rename origin OpenSmalltalk $ git remote -v (and later you can revert doing...) ($ git remote rename OpenSmalltalk origin) Now $ git fetch $ git branch -r should show... OpenSmalltalk/Cog OpenSmalltalk/JMM/CMDKey OpenSmalltalk/JMM/SleepTime OpenSmalltalk/LLP64 OpenSmalltalk/SpurPlanningCompactor etc... Now without *absolutely*no*risk* to your local work, you can review the difference between two remote branches on github.. $ git diff OpenSmalltalk/Cog OpenSmalltalk/JMM//SleepTime or your local branch and a remote branch... $ git diff Cog OpenSmalltalk/JMM//SleepTime or if your working is clean... $ git checkout Cog $ git diff JMM//SleepTime Note that you can use <tab> completion for the branch names. So btw that is how *I* *need* to do it since I work in my own "bencoman" fork, and long time ago I did this... $ git remote add OpenSmalltalk https://github.com/OpenSmalltalk/opensmalltalk-vm.git but since you work in the mainline "OpenSmalltalk" fork you could do this... $ git diff Cog JMM//SleepTime or... $ git checkout Cog $ git diff JMM//SleepTime However I believe (not tested), if OpenSmalltalk/JMM//SleepTime moves ahead, you would need to do this... $ git fetch $ git checkout JMM/SleepTime $ git merge $ git diff Cog and $ git fetch $ git diff OpenSmalltalk/Cog OpenSmalltalk/JMM//SleepTime seems a little easier and *always* means the same thing regardless of which branch I am working in. Now looking at https://github.com/OpenSmalltalk/opensmalltalk-vm/network I see that JMM/SleepTime is just a single commit off the mainline, so if you want to see just those changes, you can do... $ git fetch $ git diff OpenSmalltalk/Cog...OpenSmalltalk/JMM/SleepTime where the ellipsis provides the difference from where the second branched off the first, which is what you are probably really interested in! [1] https://longair.net/blog/2009/04/16/git-fetch-and-merge/ -------- Now just to round things out, you could review the changes from Guido's Nopsys fork like this... $ git remote add charig https://github.com/charig/opensmalltalk-vm.git $ git fetch $ git diff OpenSmalltalk/Cog..charig/Cog although I'm not sure if the paltform submodule is included (??) cheers -ben |
Free forum by Nabble | Edit this page |