Changes

no edit summary
Line 1: Line 1:  +
Cast of this drama:
 +
*bernie is advisor,
 +
*godiard is new maintainer of paint activity,
 +
*Quozl is contributor who has a repository with edits to be merged.
 +
 +
godiard has to merge the contributions and then push.
 +
 
:'''<bernie>'''  godiard: then, regarding your second question, you'll need some git-fu. let me know when you're ready
 
:'''<bernie>'''  godiard: then, regarding your second question, you'll need some git-fu. let me know when you're ready
 
:'''<bernie>'''  godiard: I'll guide you through the process
 
:'''<bernie>'''  godiard: I'll guide you through the process
Line 260: Line 267:  
  e4e1d7a HEAD@{0}: checkout: moving from master to e4e1d7a25550594f6c8d745203f1c110da400c26^0
 
  e4e1d7a HEAD@{0}: checkout: moving from master to e4e1d7a25550594f6c8d745203f1c110da400c26^0
 
  3fb9bd6 HEAD@{1}: clone: from git://git.sugarlabs.org/paint/mainline.git
 
  3fb9bd6 HEAD@{1}: clone: from git://git.sugarlabs.org/paint/mainline.git
 +
 +
Jun 09 14:07:40 <bernie> Quozl: the fact is that this rebase was kind of a fake rebase because nothing happened on mainline after you created your branch
 +
Jun 09 14:08:52 <godiard> bernie: ok
 +
Jun 09 14:14:16 <bernie> godiard: so, are you back to a history in which the rebase was not done?
 +
Jun 09 14:15:16 <godiard> bernie: i don think so
 +
Jun 09 14:15:20 <godiard> i have
 +
Jun 09 14:15:20 <bernie> godiard: you can ensure about it by doing: git log --pretty=oneline
 +
Jun 09 14:16:15 <godiard> bernie: i see the commits to quozl repo
 +
Jun 09 14:16:46 <godiard> when i do "git reflog"
 +
Jun 09 14:16:48 <godiard> i have
 +
Jun 09 14:16:51 <Quozl> bernie: you only got us to do git reflog.
 +
Jun 09 14:16:56 <godiard> e4e1d7a HEAD@{0}: checkout: moving from master to e4e1d7a25550594f6c8d745203f1c110da400c26^0
 +
Jun 09 14:16:56 <godiard> 3fb9bd6 HEAD@{1}: clone: from git://git.sugarlabs.org/paint/mainline.git
 +
Jun 09 14:17:01 <Quozl> bernie: you didn't say to do anything after that.
 +
Jun 09 14:17:29 * Quozl imitates an obedient puppy
 +
Jun 09 14:17:38 <godiard> :)
 +
Jun 09 14:18:27 <bernie> godiard: ah, ok you need to reset
 +
Jun 09 14:18:37 <bernie> godiard: like this: git reset --hard  HEAD@{1}
 +
Jun 09 14:18:53 <bernie> Quozl: you're right :)
 +
Jun 09 14:19:02 <godiard> ok!
 +
Jun 09 14:19:17 <godiard> HEAD is now at 3fb9bd6 Commit from Sugar Labs: Translation System by user Clytie.: 57 of 57 messages translated (0 fuzzy).
 +
Jun 09 14:19:19 <Quozl> so, a "reset" doesn't change files, but does change the repository's belief in historic position.
 +
Jun 09 14:19:43 <Quozl> ah, the --hard is different.
 +
Jun 09 14:19:53 <bernie> godiard: the HEAD@{1} is a special syntax meaning "whatever was at HEAD, but 1 step back in time (i.e. undo one thing from the reflog)
 +
Jun 09 14:20:12 <godiard> bernie: ok, --hard change files?
 +
Jun 09 14:20:20 <bernie> Quozl: yeah, hard does both the repository and the files. so you keep things consistent
 +
Jun 09 14:20:31 <Quozl> bernie: why would you not "git checkout HEAD@{1}" instead?
 +
Jun 09 14:20:53 <bernie> Quozl: sometimes you want to do only the repo and not the files, so you can keep the changes and redo your commit in a different way
 +
Jun 09 14:21:19 <Quozl> bernie: how different is "git checkout HEAD@{1}" from "git reset --hard HEAD@{1}" ?
 +
Jun 09 14:21:24 <bernie> Quozl: if you did "git checkout HEAD@{1}" you'd get your files to the previous state, but the history would remain unaltered
 +
Jun 09 14:21:42 <bernie> Quozl: checkout changes local files, not the repository
 +
Jun 09 14:22:17 <Quozl> bernie: but isn't the history still there in the repository and reachable with a "git checkout HEAD@{1}" now?
 +
Jun 09 14:23:21 <bernie> Quozl: you're not thinking quadrimensionally, marty!
 +
Jun 09 14:24:02 <Quozl> bernie: so "git reset --hard HEAD@{1}" actually destroyed history?
 +
Jun 09 14:24:05 <bernie> Quozl: there are 3 distinct things:
 +
Jun 09 14:24:21 <bernie> Quozl: 1) the files in your sandbox. they can be the same of any revisions, or they can be changed by you with a text editor
 +
Jun 09 14:24:53 <Quozl> 1) the files in your sandbox ... would have been changed by "git checkout HEAD@{1}" and by "git reset --hard HEAD@{1}", right?
 +
Jun 09 14:24:57 <bernie> Quozl: 2) the revisions in your history... the current branch, other branches and all the remote branches you like
 +
Jun 09 14:25:29 <Quozl> 2) the revisions in your history ... both commands appear to move current point in history to a point that omits the revisions that were previously there, right?
 +
Jun 09 14:26:04 <bernie> Quozl: 3) this is the magic: the repository can contain any number of revisions which don't even show up in any branch! these may have become unreachable as a result of a "destructive" operation such as reset or rebase
 +
Jun 09 14:26:24 <Quozl> bernie: unreachable unless you know the hash, or read reflog, right?
 +
Jun 09 14:26:46 <bernie> Quozl: to answer your (1), yes, both commands would have changed the regular files in your sandbox
 +
Jun 09 14:27:38 <bernie> Quozl: to answer (2), both move your sandbox in time, but one (reset) also *changes* the timeline: -)
 +
Jun 09 14:28:09 <bernie> Quozl: you can rewrite history in git in such a way that some commits no longer exist, or even happen in different orders!
 +
Jun 09 14:28:51 <Quozl> bernie: i can't see the difference between reset and checkout ... change the timeline ... you mean the log of patches, or something else?
 +
Jun 09 14:29:18 <bernie> Quozl: to answer your last question about reachability: yes, if you remember the hash you can recover any odd revision... and the reflog helps you remember the last N hashes where your HEAD was pointing to
 +
Jun 09 14:29:57 <bernie> Quozl: yes, the log... you would no longer see the same stuff in the log after a reset
 +
Jun 09 14:30:20 <bernie> Quozl: a checkout, insteead, will just... check-out the stuff from a particular point in the log and not touch the log itself
 +
Jun 09 14:30:36 <bernie> godiard: I hope we have confused you enough by now :-)
 +
Jun 09 14:31:04 <godiard> bernie: i am trying to understand :)
 +
Jun 09 14:31:07 <cjb> bernie: you can only push those things if your remote isn't configured to deny non-fastforwards though
 +
Jun 09 14:31:12 <cjb> (as most remotes are starting to be)
 +
Jun 09 14:32:51 <bernie> cjb: in the general case of history reweite, you'd be right... but I won't make godiard change anything before origin/master so the remote git won't notice any anomaly in the space-time continuum
 +
Jun 09 14:33:07 <bernie> godiard: I hope this is perfectly clear :-)
 +
Jun 09 14:33:14 <Quozl> bernie: i've just done a test ... clone, remote add, fetch, rebase ... and in one repo i did reset --hard HEAD@{1} and in the other i did checkout HEAD@{1} ... and looking at both repos with gitk i can't see any difference in history or sandbox.
 +
Jun 09 14:34:09 <bernie> godiard:  if not, cfr. On The Electrodynamics of Moving Bodies, Albert Einstein
 +
Jun 09 14:34:12 <Quozl> bernie: so please proceed with godiard and i'll do the same actions godiard does but in two repos; one with reset, one with checkout, so i can understand.
 +
Jun 09 14:34:46 <bernie> Quozl: k
 +
Jun 09 14:35:10 <godiard> bernie: it is too simple to quozl :) , but for me its ok
 +
Jun 09 14:35:10 <bernie> godiard: ok, did you reset your tree?
 +
Jun 09 14:35:17 <godiard> yes
 +
Jun 09 14:35:47 <bernie> godiard: now you can happily do the "usual" thing a maintainer would do to merge someone else's repo: git merge quozl/master
 +
Jun 09 14:36:08 <bernie> godiard: this will show pretty stats... even in color if you enabled it in your ~/.gitconfig
 +
Jun 09 14:37:18 <bernie> Quozl, godiard: this is my ~/.gitconfig in case someone wants to beautify their git environment: http://people.sugarlabs.org/bernie/.gitconfig
 +
Jun 09 14:37:40 <bernie> Quozl: there's a record 78 from dsd?
 +
Jun 09 14:37:44 <bernie> Quozl: is it in aslo?
 +
Jun 09 14:38:31 <godiard> bernie: git log show all the changes again
 +
Jun 09 14:38:35 <Quozl> bernie: http://dev.laptop.org/~dsd/record/Record-78.xo ... i don't know if it is in aslo, i don't know how to get a list of what is in aslo, sorry.
 +
Jun 09 14:39:09 <godiard> bernie: the changes are in my local repo or in the remote repo now?
 +
Jun 09 14:39:19 <bernie> godiard: ok, now we start editing them one by one
 +
Jun 09 14:39:33 <godiard> bernie: ok, how?
 +
Jun 09 14:39:40 <Quozl> godiard: they are only local, you can verify that by comparing "git log" locally with git.sugarlabs.org via web browser.
 +
Jun 09 14:39:42 <bernie> godiard: to do this, we use rebase again... but this time we make it.... INTERACTIVE!
 +
Jun 09 14:39:45 <bernie> ta-da!
 +
Jun 09 14:40:24 <bernie> godiard: and we do the rebase against origin/master, so that our history will look nice against it, with no merges and no crap in the middle. only good patches.
 +
Jun 09 14:40:32 <Quozl> but how?
 +
Jun 09 14:40:36 <godiard> bernie: you are enjoying it ...
 +
Jun 09 14:40:45 <Quozl> while we must suffer.  ;-)
 +
Jun 09 14:41:00 <bernie> dsd_: is Record-78 in aslo? and is the code in the same repo where m_anish_ has been working?
 +
Jun 09 14:41:33 <bernie> godiard: yup :)
 +
Jun 09 14:41:57 <bernie> godiard: so, the exact command should be:  git rebase --interactive origin/master
 +
Jun 09 14:42:50 <bernie> godiard: this is a very common comand for the contributor workflow. it's even available as a shortcut when you pull: git pull --rebase
 +
Jun 09 14:44:03 <bernie> godiard: after you issue that command, git will bring up your favorite text editor. don't exit yet, look at it for a while
 +
Jun 09 14:44:28 <godiard> bernie: i look
 +
Jun 09 14:44:46 <godiard> bernie: one line by commit, first word its a cvommand
 +
Jun 09 14:45:39 <bernie> godiard: exactly. you can replace the "pick" with "edit" for each commit you'd like to change
 +
Jun 09 14:46:02 <bernie> godiard: you could do crazy things with this, but we'll just change the authors here and there
 +
Jun 09 14:46:15 <godiard> bernie: the comment must be in the same line?
 +
Jun 09 14:46:28 <bernie> Quozl: there might be a conflict at some point due to your branch & merge
 +
Jun 09 14:46:37 <godiard> bernie: i don't see the authors
 +
Jun 09 14:47:03 <bernie> godiard: oh, that comes later. now you just say "edit" where you want to make a change..
 +
Jun 09 14:47:28 <bernie> godiard: you can also swap some commits. this will make the commits appear in that order in the final log
 +
Jun 09 14:47:50 <bernie> godiard: if you remove a line, then that commit will be lost
 +
Jun 09 14:47:55 <Quozl> (bernie: the branch and merge were *caused* by doing an interactive rebase where authors were changed.  i think my mistake was to include the whole set in a push.)
 +
Jun 09 14:48:28 <bernie> godiard: it would be useful if some of quozl patches were crap you didn't want to merge. but it'snot the case.
 +
Jun 09 14:48:51 <bernie> Quozl: git is forgiving
 +
Jun 09 14:49:22 <Quozl> 87aa is a rewrite of a59d.
 +
Jun 09 14:49:36 <bernie> Quozl, godiard: now it's up to you two to decide which patches need editing... which ones to drop, etc. I don't know the code.
 +
Jun 09 14:50:04 <godiard> bernie: ok, i selected one to change the author
 +
Jun 09 14:51:08 <godiard> bernie: i must select all now?
 +
Jun 09 14:51:22 <bernie> godiard: yes... and no
 +
Jun 09 14:51:33 <Quozl> bernie: how can one patch at a time be done?
 +
Jun 09 14:51:35 <bernie> godiard: if you forget some, you'll always be able to do another rebase later
 +
Jun 09 14:52:04 <bernie> Quozl: hehe, you'll see... it's a multi-step process.
 +
Jun 09 14:52:10 <Quozl> so i'm dorpping a59d, 125a and 76e7.
 +
Jun 09 14:52:15 <Quozl> so i'm dropping a59d, 125a and 76e7.
 +
Jun 09 14:52:41 <bernie> Quozl: and also editing a few others?
 +
Jun 09 14:53:34 <Quozl> godiard: e430 is really yours and mine together; your idea, my rewrite.
 +
Jun 09 14:53:50 <godiard> quozl: it's ok
 +
Jun 09 14:54:11 <Quozl> some of the commits don't have bug number in commit first line.
 +
Jun 09 14:54:45 <Quozl> 50d3 and b476 need author e-mail fixed.
 +
Jun 09 14:55:51 * bernie sits back and enjoys
 +
Jun 09 14:56:48 <godiard> quozl: its true
 +
Jun 09 14:57:04 <godiard> bernie: can i change the commment here?
 +
Jun 09 14:57:18 <Quozl> godiard: you change comment by using the word "reword".
 +
Jun 09 14:57:48 <bernie> godiard: it's useless, you'll be able to change the comment at a later step
 +
Jun 09 14:57:48 <Quozl> the two "changing cursors" commits could be squashed.
 +
Jun 09 14:58:11 <bernie> godiard: comments are usually multiline... the comment here is just a reminder to identify the patch
 +
Jun 09 14:58:32 <godiard> berni: ok
 +
Jun 09 14:58:35 <bernie> godiard: just mark the patches you'd like to edit as "edit" now
 +
Jun 09 14:58:44 <godiard> bernie: ok
 +
Jun 09 14:58:59 <bernie> Quozl: when you're done, please send a pastebin with your final status
 +
Jun 09 14:59:43 <Quozl>
 +
 +
edit b47608b fix #1015
 +
edit 50d3f86 fix #1902
 +
pick 87aabba fix #931
 +
pick 04a9bd1 turn off activity sharing #1863
 +
pick 92a83e5 move free form tool
 +
pick e430f27 use cursors from Sugar theme
 +
pick fde3dae changed cursors
 +
squash 4a60d01 changed cursors
 +
pick 0516bbb fix OLPC #296
 +
pick e4e1d7a fix OLPC #3695
 +
 +
Jun 09 15:01:08 <godiard> quozl: ok
 +
Jun 09 15:01:32 <bernie> Quozl: no edits needed?
 +
Jun 09 15:01:37 <bernie> yama: hola
 +
Jun 09 15:01:46 <Quozl> bernie: there were edits there, missed them?
 +
Jun 09 15:02:29 <bernie> Quozl: oh yeah, now I see them
 +
Jun 09 15:03:25 <Quozl> bernie: so when should godiard and i exit this editor of interactive rebase?
 +
Jun 09 15:03:34 <bernie> godiard, Quozl: ok, I think we're all on the same page now. I'll save and exit
 +
Jun 09 15:03:50 <bernie> (my vim nicely colors the git rebase syntax, I'm amazed)
 +
Jun 09 15:04:43 <godiard> bernie: ok, and now?
 +
Jun 09 15:04:50 <Quozl> but how to change author?  git commit --amend --author?
 +
Jun 09 15:05:03 <bernie> godiard: ok, now git will apply the first few patches and stop at the first "edit" patch
 +
Jun 09 15:05:27 <godiard> bernie: with git commit ?
 +
Jun 09 15:05:34 <Quozl> Stopped at b47608b... fix #1015
 +
Jun 09 15:05:42 <bernie> godiard: this is your special opportunity to edit _anything_ you want: move files around, change the content of files, etc...
 +
Jun 09 15:06:06 <Quozl> git commit --amend --author "Gonzalo Odiard <godiard@gmail.com>"
 +
Jun 09 15:06:26 <Quozl> oh, so you can make other changes as well and commit?
 +
Jun 09 15:06:35 <Quozl> fascinating.
 +
Jun 09 15:06:38 <bernie> godiard: because we don't want to do any of this crap, we'll simply say: git commit --amend --author "Gonzalo Odiard <gonzalo@example.com>"
 +
Jun 09 15:07:00 <bernie> Quozl: hehe you can even split a commit in two this way
 +
Jun 09 15:07:26 <Quozl> bernie: people who don't take the time to review patches often need them split up ... it's like serving porridge.
 +
Jun 09 15:07:27 <bernie> Quozl: (by doing two commits before issuing the "git rebase --continue"
 +
Jun 09 15:07:50 <bernie> Quozl: I think git is one of the most amazing development tools ever created
 +
Jun 09 15:08:01 <Quozl> Stopped at 50d3f86... fix #1902
 +
Jun 09 15:08:09 <bernie> Quozl: calling it a version control system is diminutive
 +
Jun 09 15:08:47 <Quozl> # This is a combination of 2 commits.
 +
Jun 09 15:09:07 <bernie> Quozl: this is giving you the opportunity to choose which log message you like the most
 +
Jun 09 15:09:13 <bernie> Quozl: or merge them
 +
Jun 09 15:09:14 <Quozl> indeed.  rebase all done.
 +
Jun 09 15:09:51 <Quozl> bernie: and, for your correction, both repos (one that was reset and one that was wound back with checkout) still look identical even after this history rewrite.
 +
Jun 09 15:10:11 <Quozl> bernie: so i contend that advising checkout is more straightforward than advising reset.
 +
Jun 09 15:10:29 <bernie> Quozl: next time you're in the middle of a rebase, for some additional fun try: git commit --amend --interactive
 +
Jun 09 15:10:38 <bernie> Quozl: you can drop individual hunks from patches
 +
Jun 09 15:11:23 <godiard> bernie: i have a problem
 +
Jun 09 15:11:32 <Quozl> aha, there is a different.  gitk says i'm on master for your reset repo, but gitk says yellow icon on the checkout repo, i'm not on master.
 +
Jun 09 15:11:37 <bernie> Quozl: you mean the files look identical? 'cause the histories should look different
 +
Jun 09 15:11:50 <Quozl> bernie: the history is identical.  the tagging is not.
 +
Jun 09 15:12:00 <bernie> Quozl: ah, I got it
 +
Jun 09 15:12:04 <godiard> bernie: when i do git rebase --continue
 +
Jun 09 15:12:18 <godiard> Automatic cherry-pick failed.  After resolving the conflicts,
 +
Jun 09 15:12:18 <godiard> mark the corrected paths with 'git add <paths>', and
 +
Jun 09 15:12:18 <godiard> run 'git rebase --continue'
 +
Jun 09 15:12:18 <godiard> Could not apply 76e76d9... fix #1015
 +
Jun 09 15:12:29 <bernie> Quozl: because "git log" will show you the history FROM WHERE YOU ARE down... but in the checkout case there's more history *after* where you are.
 +
Jun 09 15:12:46 <bernie> godiard: strange, I did not get this
 +
Jun 09 15:13:01 <bernie> godiard: probably you forgot to remove one of the double patches.
 +
Jun 09 15:13:04 <Quozl> bernie: you mean because master in that repo is tied to a commit on another branch of the history.
 +
Jun 09 15:13:14 <bernie> godiard: that's easy to solve: git rebase --skip
 +
Jun 09 15:13:30 <Quozl> godiard: i did not get this either.  perhaps you had different set of patches chosen.
 +
Jun 09 15:13:58 <bernie> godiard: normally you'd look what needs to be adjusted, fix the conflicts, then "git add" the files you fixed
 +
Jun 09 15:14:14 <bernie> godiard: this time we don't want the patch so we can simply skip
 +
Jun 09 15:14:35 <godiard> bernie: how?
 +
Jun 09 15:14:59 <bernie> godiard: git rebase --skip
 +
Jun 09 15:15:11 <Quozl> godiard: the error you posted says 76e76d9 ... this patch i removed by deleting the line in the rebase editor.
 +
Jun 09 15:15:22 <Quozl> godiard: so just skip it.
 +
Jun 09 15:15:31 <Quozl> godiard: you may get the same for 125 and a59.
 +
Jun 09 15:15:40 <bernie> Quozl: yeah, 76e76d9 is one of those we wanted to delete
 +
Jun 09 15:16:12 <godiard> quozl: ok
 +
Jun 09 15:16:19 <Quozl> bernie: so, how do i bring the "master" tag down to my current revised history (in the repo that i used checkout in, unrelated to what godiard is doing)
 +
Jun 09 15:16:27 <godiard> quozl: Could not apply 125a5dc... fix #1902
 +
Jun 09 15:16:33 <Quozl> godiard: skip 125.
 +
Jun 09 15:16:50 <bernie> Quozl: with reset.
 +
Jun 09 15:16:57 <Quozl> bernie: bwahahah.
 +
Jun 09 15:16:58 <godiard> quozl: i think git did it
 +
Jun 09 15:17:05 <Quozl> godiard: check history with gitk or git log
 +
Jun 09 15:17:06 <bernie> Quozl: reset is used to... reset where branches point
 +
Jun 09 15:18:01 <godiard> quozl: i see
 +
Jun 09 15:18:14 <Quozl> "Successfully rebased and updated detached HEAD." is the subtle message I got in my alternate alternate reality.
 +
Jun 09 15:18:19 <bernie> Quozl: btw, I recommend this excellent article to anyone who wants to work with git beyond svn emulation: http://www.newartisans.com/2008/04/git-from-the-bottom-up.html
 +
Jun 09 15:18:29 <Quozl> i've read it.
 +
Jun 09 15:19:47 <bernie> godiard: when you're done, you may want to admire the result with: gitk --all
 +
Jun 09 15:20:09 <godiard> bernie: i did a mistake porbably
 +
Jun 09 15:20:40 <Quozl> bernie: in my alternate reality, "git reset master" was all that was required.  by switching master from what it was to this revised history, i've effectively and intentionally lost the old history as far as tagging is concerned.  naturally i could get it back with reflog.
 +
Jun 09 15:20:44 <godiard> bernie: but it s 2 am here
 +
Jun 09 15:21:34 <godiard> bernie: i will try again tomorrow
 +
Jun 09 15:21:37 <bernie> godiard: here 1am
 +
Jun 09 15:21:51 <bernie> godiard: you know how to reset, revert, rebase, retry... :-)
 +
Jun 09 15:21:53 <Quozl> nope, "git reset master" wasn't the right thing to do.
 +
Jun 09 15:22:25 <bernie> Quozl: no, it's git reset <commit of where you are now>
 +
Jun 09 15:22:27 <godiard> bernie: i know who knows :)
 +
Jun 09 15:22:36 <Quozl> so there's this willow tree, and i've split a frond half way up, and want to band aid it back on.
 +
Jun 09 15:23:04 <Quozl> bernie: that too does not move master.
 +
Jun 09 15:23:19 <bernie> Quozl: damn
 +
Jun 09 15:23:25 <bernie> Quozl: oh, I know why
 +
Jun 09 15:23:27 <godiard> bernie, quozl: thanks, i see you
 +
Jun 09 15:23:31 <Quozl> godiard: bye.
 +
Jun 09 15:23:37 <bernie> Quozl: now you're in a weird limbo called "detached head"
 +
Jun 09 15:23:41 <Quozl> godiard: come back for more tomorrow ... for the push.
 +
Jun 09 15:23:50 <-- godiard has quit (Quit: Ex-Chat)