Branching strategy for git

Dmitry Pavlov zeldigas at gmail.com
Tue Mar 25 14:35:38 EDT 2014


As I said, you'll just see a fork and merge but without identification of
"private branch". I made a small local example and the result:
*   124d38e (HEAD, origin/master, master) Merge branch 'private'
|\
| * cbcff86 change in private
* | ebe2dec another commit in master
* | 4bfde8e change in master
|/
* 9b2b43b initial

full prompt of the process with "upstream" repos and two "dev" is in
attachment



2014-03-25 22:00 GMT+04:00 John Ralls <jralls at ceridwen.us>:

>
> On Mar 25, 2014, at 9:52 AM, Dmitry Pavlov <zeldigas at gmail.com> wrote:
>
> > Branch is just a pointer to head of revisions list (node in revision
> tree) .
> > So if you merge private branch in branch that is then pushed to public,
> it will be visible like this:
> > http://git-scm.com/figures/18333fig0317-tn.png
> > But without pointer to iss53
>
> Yes, that’s what I said I thought was the case.* I’d have more confidence
> in that claim if the reference wasn’t figure 3.17 from
> http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging in
> the section “basic merging”. Unfortunately, Chacon doesn’t explicitly cover
> what the history on the remote will look like when one pushes the merge of
> a private branch, even in
> http://git-scm.com/book/en/Distributed-Git-Maintaining-a-Project#Integrating-Contributed-Workwhere he covers the subject explicitly; he seems to consider only the case
> where all branches are pushed, and he illustrates only what the local repo
> looks like.
>
> Regards,
> John Ralls
>
> *Quibble: Not quite a pointer. More like a symbolic link in the file
> system or a database foreign key, because it contains the *name* of the
> commit, not its address. And not necessarily the head of the list; the
> commit pointed to may be the parent of another commit, as it is in the
> illustration.




-- 
С уважением,
Дмитрий Павлов
-------------- next part --------------
dmitry at acernt:/tmp$ mkdir git-tests
dmitry at acernt:/tmp$ cd git-tests/
dmitry at acernt:/tmp/git-tests$ mkdir upstream
dmitry at acernt:/tmp/git-tests$ cd upstream/
dmitry at acernt:/tmp/git-tests/upstream$ git init --bare
Initialized empty Git repository in /tmp/git-tests/upstream/
dmitry at acernt:/tmp/git-tests/upstream$ cd ..
dmitry at acernt:/tmp/git-tests$ rmdir a b
dmitry at acernt:/tmp/git-tests$ git clone upstream a
Cloning into 'a'...
done.
warning: You appear to have cloned an empty repository.
dmitry at acernt:/tmp/git-tests$ git clone upstream b
Cloning into 'b'...
done.
warning: You appear to have cloned an empty repository.
dmitry at acernt:/tmp/git-tests$ cd a
dmitry at acernt:/tmp/git-tests/a$ touch a b c
dmitry at acernt:/tmp/git-tests/a$ git add a b c 
dmitry at acernt:/tmp/git-tests/a$ git commit -m "initial"
[master (root-commit) 9b2b43b] initial
 0 files changed
 create mode 100644 a
 create mode 100644 b
 create mode 100644 c
dmitry at acernt:/tmp/git-tests/a$ git push origin master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 213 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
To /tmp/git-tests/upstream
 * [new branch]      master -> master
dmitry at acernt:/tmp/git-tests/a$ cd ../b
dmitry at acernt:/tmp/git-tests/b$ git pull
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From /tmp/git-tests/upstream
 * [new branch]      master     -> origin/master
dmitry at acernt:/tmp/git-tests/b$ git branch
* master
dmitry at acernt:/tmp/git-tests/b$ git checkout -b private
Switched to a new branch 'private'
dmitry at acernt:/tmp/git-tests/b$ echo "private branch change" > b
dmitry at acernt:/tmp/git-tests/b$ git add b
dmitry at acernt:/tmp/git-tests/b$ git commit -m "change in private"
[private cbcff86] change in private
 1 file changed, 1 insertion(+)
dmitry at acernt:/tmp/git-tests/b$ git checkout master 
Switched to branch 'master'
dmitry at acernt:/tmp/git-tests/b$ echo "change in master" > a
dmitry at acernt:/tmp/git-tests/b$ git add a
dmitry at acernt:/tmp/git-tests/b$ git commit -m "change in master"
[master 4bfde8e] change in master
 1 file changed, 1 insertion(+)  
dmitry at acernt:/tmp/git-tests/b$ echo "another change" > c
dmitry at acernt:/tmp/git-tests/b$ git add c
dmitry at acernt:/tmp/git-tests/b$ git commit -m "another commit in master"
[master ebe2dec] another commit in master
 1 file changed, 1 insertion(+)
dmitry at acernt:/tmp/git-tests/b$ git merge private 
Merge made by the 'recursive' strategy.
 b |    1 +
 1 file changed, 1 insertion(+)
dmitry at acernt:/tmp/git-tests/b$ git push origin master
Counting objects: 13, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (11/11), 1.02 KiB, done.
Total 11 (delta 1), reused 0 (delta 0)
Unpacking objects: 100% (11/11), done.
To /tmp/git-tests/upstream
   9b2b43b..124d38e  master -> master
dmitry at acernt:/tmp/git-tests/b$ git branch
* master
  private
dmitry at acernt:/tmp/git-tests/b$ cd ../a
dmitry at acernt:/tmp/git-tests/a$ git pull
remote: Counting objects: 13, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 11 (delta 1), reused 0 (delta 0)
Unpacking objects: 100% (11/11), done.
From /tmp/git-tests/upstream
   9b2b43b..124d38e  master     -> origin/master
Updating 9b2b43b..124d38e
Fast-forward
 a |    1 +
 b |    1 +
 c |    1 +
 3 files changed, 3 insertions(+)
dmitry at acernt:/tmp/git-tests/a$ git log --oneline --graph --decorate --all
*   124d38e (HEAD, origin/master, master) Merge branch 'private'
|\  
| * cbcff86 change in private
* | ebe2dec another commit in master
* | 4bfde8e change in master
|/  
* 9b2b43b initial
dmitry at acernt:/tmp/git-tests/a$ git branch
* master



More information about the gnucash-devel mailing list