Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
svn copy trunk branches/myBranch
svn commit -m 'add branch myBranch'
http://svn.myrepo.com/svn copy http://svn.myrepo.com/trunk http://svn.myrepo.com/branches/myBranchsvn switch http://svn.myrepo.com/branches/myBranch . As you are probably aware, some people have tried to import the whole KDE
history into git. Quite frankly, the way git works (tracking whole trees
at a time, never single files), that ends up being very painful, because
it's an «all or nothing» approach.
So I'm hoping that if you guys are seriously considering git, you'd also
split up the KDE repository so that it's not one single huge one, but with
multiple smaller repositories (ie kdelibs might be one, and each major app
would be its own), and then using the git «submodule» support to tie it
all together.
я перешел на Git с SVN, где ветвление было достаточно дорогим процессом: для создания ветки нужно было скопировать весь рабочий каталог.поясните тем, кто знает про svn switch?
master A -> B -> C
shitcommits \ -> D -> E
master A -> B -> C -> D+E(squash)
shitcommits \ -> D -> E
master A -> B -> C -> D+E(squash)
shitcommits \ -> D -> E -> F
master A -> B -> C -> (merge_shitcommits_r)
shitcommits \ -> D+E -> /
shitcommits[0] \ -> D -> E
Merge branch 'feature_branch' into develop Они «пустые» в случае отсутствия конфликтов при мерже.
git checkout develop && git merge --no-ff feature_branch && git push. Ваш вопрос, к сожалению, обычно приводит к холивору «merge vs. rebase»
(develop)$ vim test.php
(develop)$ cat test.php
<?php
echo 'Hello world';
(develop)$ git add test.php
(develop)$ git commit -m 'One commit'
[develop ad4834f] [develop]: One commit
1 file changed, 2 insertions(+)
create mode 100644 test.php
(develop)$ git checkout feature
Switched to branch 'feature'
(feature)$ vim test.php
(feature)$ cat test.php
<?php
echo 'Hello world (from feature)';
(feature)$ git add test.php
(feature)$ git commit -m 'Feature commit'
[feature c996a10] Feature commit
1 file changed, 3 insertions(+)
create mode 100644 test.php
(feature)$ git checkout develop
Switched to branch 'develop'
(develop)$ git merge feature
Auto-merging test.php
CONFLICT (add/add): Merge conflict in test.php
Automatic merge failed; fix conflicts and then commit the result.
(develop|MERGING)$ git status
# On branch develop
# You have unmerged paths.
# (fix conflicts and run "git commit")
#
# Unmerged paths:
# (use "git add <file>..." to mark resolution)
#
# both added: test.php
#
no changes added to commit (use "git add" and/or "git commit -a")
(develop|MERGING)$ git diff test.php
diff --cc test.php
index bd1ca6f,1001057..0000000
--- a/test.php
+++ b/test.php
@@@ -1,2 -1,3 +1,7 @@@
<?php
++<<<<<<< HEAD
+echo 'Hello world';
++=======
+
+ echo 'Hello world (from feature)';
++>>>>>>> feature
(develop|MERGING)$ vim test.php
(develop|MERGING)$ git status
# On branch develop
# You have unmerged paths.
# (fix conflicts and run "git commit")
#
# Unmerged paths:
# (use "git add <file>..." to mark resolution)
#
# both added: test.php
#
no changes added to commit (use "git add" and/or "git commit -a")
(develop|MERGING)$ cat test.php
<?php
echo 'Hello world (from feature)';
(develop|MERGING)$ git add test.php
(develop|MERGING)$ git commit
[develop 8355f7c] [develop]: Merge branch 'feature' into develop
(develop)$ git log -p
commit 8355f7c42f619c46ba448732d1bc27302d4f8d73
Merge: ad4834f c996a10
Author: Yuriy Nasretdinov <...>
Date: Mon Sep 30 19:38:02 2013 +0400
[develop]: Merge branch 'feature' into develop
Conflicts:
test.php
... # якобы нет изменений, «пустой» коммит
(develop)$ git show
commit 8355f7c42f619c46ba448732d1bc27302d4f8d73
Merge: ad4834f c996a10
Author: Yuriy Nasretdinov <y.nasretdinov@corp.badoo.com>
Date: Mon Sep 30 19:38:02 2013 +0400
[develop]: Merge branch 'feature' into develop
Conflicts:
test.php
diff --cc test.php
index bd1ca6f,1001057..614ad2b
--- a/test.php
+++ b/test.php
@@@ -1,2 -1,3 +1,3 @@@
<?php
- echo 'Hello world';
-
+ echo 'Hello world (from feature)';
++
(feature)$ git show
commit 504e36a28a81c175518ca4b478e28d93e3146df8
Merge: c278018 5654da6
Author: Evgeniy Makhrov <e.makhrov@corp.badoo.com>
Date: Thu Oct 31 03:12:01 2013 +0400
Merge branch 'bugfix' into feature
Conflicts:
test.php
(feature)$ git show -m
commit 504e36a28a81c175518ca4b478e28d93e3146df8 (from 5654da6fa73e780b9d9ecb06b3a3b90f6707b9c2)
Merge: c278018 5654da6
Author: Evgeniy Makhrov <e.makhrov@corp.badoo.com>
Date: Thu Oct 31 03:12:01 2013 +0400
Merge branch 'bugfix' into feature
Conflicts:
test.php
diff --git a/test.php b/test.php
index 51de675..8fc81b9 100644
--- a/test.php
+++ b/test.php
@@ -1,4 +1,4 @@
<?php
-echo "Hello, world\n";
+echo "Hello from feature\n";
(feature)$ git log -1 -p
commit 504e36a28a81c175518ca4b478e28d93e3146df8
Merge: c278018 5654da6
Author: Evgeniy Makhrov <e.makhrov@corp.badoo.com>
Date: Thu Oct 31 03:12:01 2013 +0400
Merge branch 'bugfix' into feature
Conflicts:
test.php
(feature)$ git log -1 -p -m
commit 504e36a28a81c175518ca4b478e28d93e3146df8 (from 5654da6fa73e780b9d9ecb06b3a3b90f6707b9c2)
Merge: c278018 5654da6
Author: Evgeniy Makhrov <e.makhrov@corp.badoo.com>
Date: Thu Oct 31 03:12:01 2013 +0400
Merge branch 'bugfix' into feature
Conflicts:
test.php
diff --git a/test.php b/test.php
index 51de675..8fc81b9 100644
--- a/test.php
+++ b/test.php
@@ -1,4 +1,4 @@
<?php
-echo "Hello, world\n";
+echo "Hello from feature\n";
git merge --no-ff
A->B->C-->(E)
\ /
->D->
A->B->C-->(E)
\ /
->D->
В каком же случае проявляется недостаток стратегии resolve? Он проявляется в том случае, если для коммита (M) нам пришлось разрешить конфликты, после чего мы продолжили разработку и еще раз хотим выполнить git merge feature -s resolve. В этом случае в качестве общего предка снова будет использован коммит C, и конфликты произойдут снова и будут нуждаться в нашем вмешательстве.
Тонкости благополучного git-merge