git Integration Manager Workflow tutorial

Submitted by alexmoreno on Fri, 11/30/2012 - 01:32

 

IN BLESSED

mkdir gitlab/blessedrepo

cd gitlab/blessedrepo

git init

 

Creating new files:

vim README

adding:

git add .

git commit -m "first file in blessed repository"

git push

 

IN DEVELOPERS

mkdir developer2

cd developer2

git clone /Users/air/gitlab/blessedrepo

ls

blessedrepo

ls blessedrepo/

README

cd blessedrepo

vim fileindev2.html

git add .

 

 

MacBook-Air-de-Air:blessedrepo air$ git commit -m "added file by developer2"

[master 422f2e5] added file by developer2

 1 file changed, 2 insertions(+)

 create mode 100644 fileindev2.html

MacBook-Air-de-Air:blessedrepo air$ 

 

 

get changes from main repository:

 

MacBook-Air-de-Air:blessedrepo air$ git pull

Already up-to-date.

MacBook-Air-de-Air:blessedrepo air$

 

 

Getting changes from a developer. In Blessedrepository, we execute:

 

 

MacBook-Air-de-Air:blessedrepo air$ git pull /Users/air/gitlab/developer2/blessedrepo/

.git/                 fileindev2.html       thirdfileindev1.html  

README                secondfile.html       

MacBook-Air-de-Air:blessedrepo air$ git pull /Users/air/gitlab/developer2/blessedrepo/

remote: Counting objects: 4, done.

remote: Compressing objects: 100% (2/2), done.

remote: Total 3 (delta 0), reused 0 (delta 0)

Unpacking objects: 100% (3/3), done.

From /Users/air/gitlab/developer2/blessedrepo

 * branch            HEAD       -> FETCH_HEAD

Updating d3bb3f1..422f2e5

Fast-forward

 fileindev2.html | 2 ++

 1 file changed, 2 insertions(+)

 create mode 100644 fileindev2.html

MacBook-Air-de-Air:blessedrepo air$

 

 

Now, Blessedrepository has the new files:

 

MacBook-Air-de-Air:blessedrepo air$ ls

README secondfile.html

fileindev2.html thirdfileindev1.html

MacBook-Air-de-Air:blessedrepo air$ 

Now, developer1 wants to get changes in main Repository:
MacBook-Air-de-Air:blessedrepo air$ git pull
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From /Users/air/gitlab/developer1/publicrepo/../../blessedrepo
   21f5117..422f2e5  master     -> origin/master
Updating d3bb3f1..422f2e5
Fast-forward
 fileindev2.html | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 fileindev2.html
MacBook-Air-de-Air:blessedrepo air$

 

Now, test conflicts. dev 1 and dev2 edit the same file, 

 

 

MacBook-Air-de-Air:blessedrepo air$ git add .

MacBook-Air-de-Air:blessedrepo air$ git commit -m "added by dev1"

[master 80f7afa] added by dev1

 Committer: Air <air@MacBook-Air-de-Air.local>

Your name and email address were configured automatically based

on your username and hostname. Please check that they are accurate.

You can suppress this message by setting them explicitly:


    git config --global user.name "Your Name"

    git config --global user.email you@example.com


After doing this, you may fix the identity used for this commit with:


    git commit --amend --reset-author


 1 file changed, 2 insertions(+)

MacBook-Air-de-Air:blessedrepo air$ 

 


 

 

Developer 2, the same:

 

 

MacBook-Air-de-Air:blessedrepo air$ git add 

Nothing specified, nothing added.

Maybe you wanted to say 'git add .'?

MacBook-Air-de-Air:blessedrepo air$ git add .

MacBook-Air-de-Air:blessedrepo air$ git commit -m "changes by dev2 in same file"

[master 20b26a8] changes by dev2 in same file

 Committer: Air <air@MacBook-Air-de-Air.local>

    git commit --amend --reset-author

 1 file changed, 2 insertions(+)

MacBook-Air-de-Air:blessedrepo air$ 

 

 

Time to pull changes from developer1 and 2 in Blessed Repository:

 

MacBook-Air-de-Air:blessedrepo air$ git pull /Users/air/gitlab/developer2/blessedrepo/

From /Users/air/gitlab/developer2/blessedrepo

 * branch            HEAD       -> FETCH_HEAD

Already up-to-date.

MacBook-Air-de-Air:blessedrepo air$ git pull /Users/air/gitlab/developer2/blessedrepo/

remote: Counting objects: 5, done.

remote: Compressing objects: 100% (2/2), done.

remote: Total 3 (delta 1), reused 0 (delta 0)

Unpacking objects: 100% (3/3), done.

From /Users/air/gitlab/developer2/blessedrepo

 * branch            HEAD       -> FETCH_HEAD

Updating 422f2e5..20b26a8

Fast-forward

 secondfile.html | 2 ++

 1 file changed, 2 insertions(+)

MacBook-Air-de-Air:blessedrepo air$ 

 

 

and from the other developer (where we expect the conflict):

 

MacBook-Air-de-Air:blessedrepo air$ git pull /Users/air/gitlab/developer1/publicrepo/blessedrepo/

remote: Counting objects: 5, done.

remote: Compressing objects: 100% (2/2), done.

remote: Total 3 (delta 1), reused 0 (delta 0)

Unpacking objects: 100% (3/3), done.

From /Users/air/gitlab/developer1/publicrepo/blessedrepo

 * branch            HEAD       -> FETCH_HEAD

Auto-merging secondfile.html

CONFLICT (content): Merge conflict in secondfile.html

Automatic merge failed; fix conflicts and then commit the result.

MacBook-Air-de-Air:blessedrepo air$ 

 

 

RESOLVE CONFLICTS

git mergetool

 

 

 

categorias