Gentoo Archives: gentoo-dev

From: hasufell <hasufell@g.o>
To: gentoo-dev@l.g.o
Cc: Patrick Lauer <patrick@g.o>, axs@g.o
Subject: Re: [gentoo-dev] git basics
Date: Mon, 15 Sep 2014 18:35:32
Message-Id: 54173163.3080604@gentoo.org
In Reply to: Re: [gentoo-dev] My masterplan for git migration (+ looking for infra to test it) by Ian Stakenvicius
1 Ian Stakenvicius:
2 > On 14/09/14 09:06 PM, Peter Stuge wrote:
3 >> Rich Freeman wrote:
4 >>> If you just want to do 15 standalone commits before you push you
5 >>> can do those sequentially easily enough. A branch would be more
6 >>> appropriate for some kind of mini-project.
7 >> ..
8 >>> That is the beauty of git - branches are really cheap. So are
9 >>> repositories
10 >
11 >> And commits.
12 >
13 >> Not only are branches cheap, they are also very easy to create,
14 >> and maybe most importantly they can be created at any time, even
15 >> after the commits.
16 >
17 >> It's quick and painless to create a bunch of commits which aren't
18 >> really closely related in sequence, and only later clean the whole
19 >> series of commits up while creating different branches for commits
20 >> which should actually be grouped rather than mixed all together.
21 >
22 >
23 > Ahh, so the secret here would then be just to git add files on a
24 > related per-package basis, leaving the other files out of the commit.
25 > that makes sense. There would still be the issue of untracked files
26 > in the repo and the ability to switch back to the 'master' branch to
27 > cherry-pick a commit for pushing, though... I guess we'd just have to
28 > deal with the delay there and try and push all of the changes at once?
29 >
30
31 First, I don't think this is related to mgornys migration plans anymore.
32
33 Second: yes, in contrary to CVS it will _never_ happen on git that you
34 accidentally commit random files because of a "dirty" tree (and that
35 happened to me as well on CVS... I didn't even know until I ran repoman
36 on a whole category by accident! oops).
37
38 There are numerous of ways to work on multiple things at once in git:
39 1) Just use different branches and sync them if necessary.
40
41 2) Don't stage everything you have modified... I guess a lot of people
42 don't really know that it's possible? As pointed out before, you can
43 even say which hunks/lines of a single file you want to have staged.
44
45 Furthermore, you don't even need to stash anything, even if you switch
46 branches, as long as the (un)staged changes don't collide with the
47 branch you are switching to (and if that is the case... then you have
48 bigger problems).
49
50 3) Although this is anti-git, you could still just copy paste the
51 repository directory. Every git repository is consistent in itself and
52 fully functional. You don't directly depend on any server. And you can
53 even pull from local git repositories. If you find this silly, do 2) or 1).

Replies

Subject Author
Re: [gentoo-dev] git basics Ian Stakenvicius <axs@g.o>