* yet another workflow question...
@ 2007-10-11 14:11 Patrick Doyle
2007-10-11 14:18 ` David Kastrup
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Patrick Doyle @ 2007-10-11 14:11 UTC (permalink / raw)
To: git
Sorry for cluttering up the list with yet another very basic workflow
question, but I'm still struggling with finding an answer to the
burning question, "What can git do for me?" (So far, I have come to
the conclusion that, for my simple, single developer, branchless,
linear projects, there's not much that git can do for me that any
other SCM could do for me. It appears to have been designed to solve
problems for which I have absolutely no appreciation whatsoever. :-))
Anyway, on to basic newbie quesion #107...
I've been working on my project and I realize that I have 3-4 files
modified with two orthogonal sets of changes. (I didn't realize this
until I said to myself -- "Self, I should really check in these files
before I go too much further down this path".) So I start "git
diff"-ing the files and I find that most files have differences
related to only one change or the other, but one file has differences
related to both changes.
What do others do in this situation?
a) Not allow themselves to get into this situation in the first place
by careful planning?
b) Copy the file to "file.bothchanges", edit out one set of changes,
commit that with one log message, edit back in the other set of
changes, edit in the other set of changes, commit that with another
log message?
c) Use some sort of automation to do option (b) for them?
d) Something else?
--wpd
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: yet another workflow question...
2007-10-11 14:11 yet another workflow question Patrick Doyle
@ 2007-10-11 14:18 ` David Kastrup
2007-10-11 14:44 ` Steffen Prohaska
2007-10-11 14:37 ` Johannes Sixt
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: David Kastrup @ 2007-10-11 14:18 UTC (permalink / raw)
To: git
"Patrick Doyle" <wpdster@gmail.com> writes:
> Sorry for cluttering up the list with yet another very basic workflow
> question, but I'm still struggling with finding an answer to the
> burning question, "What can git do for me?" (So far, I have come to
> the conclusion that, for my simple, single developer, branchless,
> linear projects, there's not much that git can do for me that any
> other SCM could do for me. It appears to have been designed to solve
> problems for which I have absolutely no appreciation whatsoever. :-))
>
> Anyway, on to basic newbie quesion #107...
>
> I've been working on my project and I realize that I have 3-4 files
> modified with two orthogonal sets of changes. (I didn't realize this
> until I said to myself -- "Self, I should really check in these files
> before I go too much further down this path".) So I start "git
> diff"-ing the files and I find that most files have differences
> related to only one change or the other, but one file has differences
> related to both changes.
>
> What do others do in this situation?
> a) Not allow themselves to get into this situation in the first place
> by careful planning?
>
> b) Copy the file to "file.bothchanges", edit out one set of changes,
> commit that with one log message, edit back in the other set of
> changes, edit in the other set of changes, commit that with another
> log message?
>
> c) Use some sort of automation to do option (b) for them?
>
> d) Something else?
git-add -i
--
David Kastrup
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: yet another workflow question...
2007-10-11 14:11 yet another workflow question Patrick Doyle
2007-10-11 14:18 ` David Kastrup
@ 2007-10-11 14:37 ` Johannes Sixt
2007-10-11 14:39 ` Wincent Colaiuta
2007-10-11 15:10 ` Andy Parkins
3 siblings, 0 replies; 9+ messages in thread
From: Johannes Sixt @ 2007-10-11 14:37 UTC (permalink / raw)
To: Patrick Doyle; +Cc: git
Patrick Doyle schrieb:
> I've been working on my project and I realize that I have 3-4 files
> modified with two orthogonal sets of changes. (I didn't realize this
> until I said to myself -- "Self, I should really check in these files
> before I go too much further down this path".) So I start "git
> diff"-ing the files and I find that most files have differences
> related to only one change or the other, but one file has differences
> related to both changes.
>
> What do others do in this situation?
> a) Not allow themselves to get into this situation in the first place
> by careful planning?
>
> b) Copy the file to "file.bothchanges", edit out one set of changes,
> commit that with one log message, edit back in the other set of
> changes, edit in the other set of changes, commit that with another
> log message?
>
> c) Use some sort of automation to do option (b) for them?
>
> d) Something else?
Use git-gui.
Stage the files relevant for the first change. In the file where you have an
overlap with the second change, you can right-click in the diff pane and
select "Stage Hunk for Commit" on the hunk relevant for the first change.[*]
Commit with a message.
Stage the remaining changes and commit again.
At this point, I usually check out HEAD~1, i.e. the state *without* the
second change, and compile and test to make sure I have a bisectable history.
[*] Of course, this works only if the changes are not in the same hunk. If
there are at least 3 unmodified lines between the changes, you can choose
"Less context" until they are in separate hunks.
-- Hannes
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: yet another workflow question...
2007-10-11 14:11 yet another workflow question Patrick Doyle
2007-10-11 14:18 ` David Kastrup
2007-10-11 14:37 ` Johannes Sixt
@ 2007-10-11 14:39 ` Wincent Colaiuta
2007-10-11 15:10 ` Andy Parkins
3 siblings, 0 replies; 9+ messages in thread
From: Wincent Colaiuta @ 2007-10-11 14:39 UTC (permalink / raw)
To: Patrick Doyle; +Cc: git
El 11/10/2007, a las 16:11, Patrick Doyle escribió:
> Sorry for cluttering up the list with yet another very basic workflow
> question, but I'm still struggling with finding an answer to the
> burning question, "What can git do for me?" (So far, I have come to
> the conclusion that, for my simple, single developer, branchless,
> linear projects, there's not much that git can do for me that any
> other SCM could do for me. It appears to have been designed to solve
> problems for which I have absolutely no appreciation whatsoever. :-))
Even with the workflow you describe, Git brings some nice benefits:
1. Faster than anything else out there
2. You can work offline (even if you have an "always on" net
connection, think about the times when it goes down)
3. You can easily amend mistakes in your last commit (git-commit --
amend)
4. You can easily stash away work in progress and go off on a tangent
(git-stash)
5. You get nice colorized diff and log output for free
6. Great visualization tools included for free (gitk, git-gui etc)
And those are just a few off the top of my head. The more you work
with Git, the more benefits you will discover, even if you're not
trying to do anything fancy with it. And although you are currently
using branchless development, you may find with time that you start
using things like topic branches simply because Git makes it so darn
easy to do so, and the benefit is that you'll keep your history much
cleaner and easier to understand when you go back to look at it later
on.
Cheers,
Wincent
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: yet another workflow question...
2007-10-11 14:18 ` David Kastrup
@ 2007-10-11 14:44 ` Steffen Prohaska
0 siblings, 0 replies; 9+ messages in thread
From: Steffen Prohaska @ 2007-10-11 14:44 UTC (permalink / raw)
To: David Kastrup; +Cc: git
On Oct 11, 2007, at 4:18 PM, David Kastrup wrote:
> "Patrick Doyle" <wpdster@gmail.com> writes:
>
>> Sorry for cluttering up the list with yet another very basic workflow
>> question, but I'm still struggling with finding an answer to the
>> burning question, "What can git do for me?" (So far, I have come to
>> the conclusion that, for my simple, single developer, branchless,
>> linear projects, there's not much that git can do for me that any
>> other SCM could do for me. It appears to have been designed to solve
>> problems for which I have absolutely no appreciation whatsoever. :-))
>>
>> Anyway, on to basic newbie quesion #107...
>>
>> I've been working on my project and I realize that I have 3-4 files
>> modified with two orthogonal sets of changes. (I didn't realize this
>> until I said to myself -- "Self, I should really check in these files
>> before I go too much further down this path".) So I start "git
>> diff"-ing the files and I find that most files have differences
>> related to only one change or the other, but one file has differences
>> related to both changes.
>>
>> What do others do in this situation?
>> a) Not allow themselves to get into this situation in the first place
>> by careful planning?
>>
>> b) Copy the file to "file.bothchanges", edit out one set of changes,
>> commit that with one log message, edit back in the other set of
>> changes, edit in the other set of changes, commit that with another
>> log message?
>>
>> c) Use some sort of automation to do option (b) for them?
>>
>> d) Something else?
>
> git-add -i
git-gui, right click on change.
From the user manual:
"""
You can also use git-gui(1) to create commits, view changes in the
index and the working tree files, and individually select diff hunks
for inclusion in the index (by right-clicking on the diff hunk and
choosing "Stage Hunk For Commit").
"""
Steffen
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: yet another workflow question...
2007-10-11 14:11 yet another workflow question Patrick Doyle
` (2 preceding siblings ...)
2007-10-11 14:39 ` Wincent Colaiuta
@ 2007-10-11 15:10 ` Andy Parkins
2007-10-11 17:28 ` Andreas Ericsson
2007-10-11 20:40 ` Jing Xue
3 siblings, 2 replies; 9+ messages in thread
From: Andy Parkins @ 2007-10-11 15:10 UTC (permalink / raw)
To: git; +Cc: Patrick Doyle
On Thursday 2007 October 11, Patrick Doyle wrote:
> burning question, "What can git do for me?" (So far, I have come to
> the conclusion that, for my simple, single developer, branchless,
> linear projects, there's not much that git can do for me that any
> other SCM could do for me. It appears to have been designed to solve
Here's a few things that are relevant to a simple, single, branchless, linear
developer:
- Fast. Git wipes the floor with everything else, so much so that the SCM
becomes a tool in itself, not just a recorder of history. I keep my own
simple projects in git just as much as my complicated, branchy, team-based
projects just to get the following tools fast:
git-diff
git-status
git-commit
git-log
- Small. In every project I've converted from SVN to git, the diskspace
usage has gone down. SVN peppers the working tree with .svn directories,
each of which contains a pristine copy of the last checked in version of
all the working files. On top of that is the repository disk space itself.
Git on the other hand keeps one .git directory at the top of the tree and
that stores the _entire_ repository. It is, in my experience, smaller than
the working tree. That means that git uses less diskspace than svn does
for a single checkout to store everything it needs.
- Useful. The following are so good, that even if you weren't doing any
revision tracking you'd still want to use them:
git-grep
git-diff
- Backup. Backing up subversion repositories requires that you write
yourself a script that uses svnadmin dump. With git I just write a couple
of lines in my .git/config and then git-push produces a highly compact
backup whenever I want. Even better, if a disaster happens it's easy to
pull stuff out of that backup without any additional operations.
- Mobility. This one is a bit distributed, but I hope you'll let me have it.
I often do work on my desktop at home, my desktop at work and my laptop.
By setting my remotes up correctly in git it's really easy to walk to
another system and pick up exactly where I left off from the other
computer. More importantly though, when you accidentally make changes in
two places, there is no danger of data loss.
Even if you aren't doing complicated stuff, git is the way to go. I can't
count the number of ways it's made me more productive and enhanced the code I
write and the documentation of its development. If I never worked on another
group project again I would still use git all day every day.
Andy
--
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: yet another workflow question...
2007-10-11 15:10 ` Andy Parkins
@ 2007-10-11 17:28 ` Andreas Ericsson
2007-10-11 20:40 ` Jing Xue
1 sibling, 0 replies; 9+ messages in thread
From: Andreas Ericsson @ 2007-10-11 17:28 UTC (permalink / raw)
To: Andy Parkins; +Cc: git, Patrick Doyle
Andy Parkins wrote:
> On Thursday 2007 October 11, Patrick Doyle wrote:
>
>> burning question, "What can git do for me?" (So far, I have come to
>> the conclusion that, for my simple, single developer, branchless,
>> linear projects, there's not much that git can do for me that any
>> other SCM could do for me. It appears to have been designed to solve
>
> Here's a few things that are relevant to a simple, single, branchless, linear
> developer:
>
> - Fast. Git wipes the floor with everything else, so much so that the SCM
> becomes a tool in itself, not just a recorder of history. I keep my own
> simple projects in git just as much as my complicated, branchy, team-based
> projects just to get the following tools fast:
> git-diff
> git-status
> git-commit
> git-log
>
> - Small. In every project I've converted from SVN to git, the diskspace
> usage has gone down. SVN peppers the working tree with .svn directories,
> each of which contains a pristine copy of the last checked in version of
> all the working files. On top of that is the repository disk space itself.
>
> Git on the other hand keeps one .git directory at the top of the tree and
> that stores the _entire_ repository. It is, in my experience, smaller than
> the working tree. That means that git uses less diskspace than svn does
> for a single checkout to store everything it needs.
>
> - Useful. The following are so good, that even if you weren't doing any
> revision tracking you'd still want to use them:
> git-grep
> git-diff
>
> - Backup. Backing up subversion repositories requires that you write
> yourself a script that uses svnadmin dump. With git I just write a couple
> of lines in my .git/config and then git-push produces a highly compact
> backup whenever I want. Even better, if a disaster happens it's easy to
> pull stuff out of that backup without any additional operations.
>
> - Mobility. This one is a bit distributed, but I hope you'll let me have it.
> I often do work on my desktop at home, my desktop at work and my laptop.
> By setting my remotes up correctly in git it's really easy to walk to
> another system and pick up exactly where I left off from the other
> computer. More importantly though, when you accidentally make changes in
> two places, there is no danger of data loss.
>
> Even if you aren't doing complicated stuff, git is the way to go. I can't
> count the number of ways it's made me more productive and enhanced the code I
> write and the documentation of its development. If I never worked on another
> group project again I would still use git all day every day.
>
I'm amazed nobody has mentioned git-bisect yet. Recently, I had an enormous amount
of benefit from it, so I'll just add it here as a success-story in case any OSS
support company comes along and wants to peddle git.
As it happens, I have a daemon that does some fairly clever scheduling. Somewhere
in a recent change, I had introduced a very subtle bug that made the latency times
for when the actions were actually happening diverge from 0s. I know I get a
latency spike just when I fire the daemon up, but it's supposed to normalize after
10 or so minutes and converge on zero-latency. Instead it was slowly increasing,
but the effects weren't really visible until after about 2 hours.
git bisect to the rescue. Since I didn't feel terribly inclined to walk over to
my computer every two hours to recompile, wipe logs and start the daemon all over
again, I hacked up a script to do it for me. The script also checked the latency
figures and re-ran git-bisect as necessary.
22 hours (or 7 bisects) later, git had, with a little help from my script, shown
me exactly the commit that introduced the latency issue. During the time, I was
enjoying a walk in the sun, dinner with my girlfriend and a good nights sleep.
Life is good when you have the proper tools.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: yet another workflow question...
2007-10-11 15:10 ` Andy Parkins
2007-10-11 17:28 ` Andreas Ericsson
@ 2007-10-11 20:40 ` Jing Xue
2007-10-12 7:25 ` Andy Parkins
1 sibling, 1 reply; 9+ messages in thread
From: Jing Xue @ 2007-10-11 20:40 UTC (permalink / raw)
To: Andy Parkins; +Cc: git, Patrick Doyle
Quoting Andy Parkins <andyparkins@gmail.com>:
> - Mobility. This one is a bit distributed, but I hope you'll let
> me have it.
> I often do work on my desktop at home, my desktop at work and my laptop.
> By setting my remotes up correctly in git it's really easy to walk to
> another system and pick up exactly where I left off from the other
> computer. More importantly though, when you accidentally make changes in
> two places, there is no danger of data loss.
To extend on this point, after picking up the randomly checked-in save
point on another computer, the save point itself can be easily
git-reset'ed. So there won't be commits like "it's utter broken but i
got to go home" polluting the history. I find that extremely handy.
Cheers.
--
Jing Xue
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: yet another workflow question...
2007-10-11 20:40 ` Jing Xue
@ 2007-10-12 7:25 ` Andy Parkins
0 siblings, 0 replies; 9+ messages in thread
From: Andy Parkins @ 2007-10-12 7:25 UTC (permalink / raw)
To: git; +Cc: Jing Xue, Patrick Doyle
On Thursday 2007 October 11, Jing Xue wrote:
> Quoting Andy Parkins <andyparkins@gmail.com>:
> > - Mobility. This one is a bit distributed, but I hope you'll let
> > me have it.
> > I often do work on my desktop at home, my desktop at work and my
> > laptop. By setting my remotes up correctly in git it's really easy to
> > walk to another system and pick up exactly where I left off from the
> > other computer. More importantly though, when you accidentally make
> > changes in two places, there is no danger of data loss.
>
> To extend on this point, after picking up the randomly checked-in save
> point on another computer, the save point itself can be easily
> git-reset'ed. So there won't be commits like "it's utter broken but i
> got to go home" polluting the history. I find that extremely handy.
Absolutely; in fact I've had times when I've done things like this:
git merge laptop-branch
git merge home-branch
git reset HEAD^^
That is to say, I'm not interested in documenting the merges, I just want to
bring a set of changes from different places together ready for some proper
commits, which of course can be done really easily with git add -i.
Andy
--
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2007-10-12 7:26 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-11 14:11 yet another workflow question Patrick Doyle
2007-10-11 14:18 ` David Kastrup
2007-10-11 14:44 ` Steffen Prohaska
2007-10-11 14:37 ` Johannes Sixt
2007-10-11 14:39 ` Wincent Colaiuta
2007-10-11 15:10 ` Andy Parkins
2007-10-11 17:28 ` Andreas Ericsson
2007-10-11 20:40 ` Jing Xue
2007-10-12 7:25 ` Andy Parkins
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).