본문 바로가기
이것저것(독후감같은거)

git merge to feature/blabla from develop

by 혜룐 2015. 11. 10.
상황
* git flow feature브랜치 작업이 길어지거나
* hotfix로 작업된 코드를 머지 하고 +feature 를 유지해야 하는 경우
git checkout feature/bla ->
git merge develop ->git push -u origin feature/bla
(저런 경우 어떻게 올라가는지 궁금하여 테스트)
1) develop에서 feature start
catherineui-MacBook-Pro-3:python_sam catherine$
git checkout develop
Switched to branch 'develop'
Your branch is up-to-date with 'origin/develop'.
catherineui-MacBook-Pro-3:python_sam catherine$
git flow feature start bla
Switched to a new branch 'feature/bla'
Summary of actions:
- A new branch 'feature/bla' was created, based on 'develop'
- You are now on branch 'feature/bla'
Now, start committing on your feature. When done, use:
git flow feature finish bla
catherineui-MacBook-Pro-3:python_sam catherine$ git flow
feature publish bla
Total 0 (delta 0), reused 0 (delta 0)
To https://github.o.com/catherine-lyn/python_sam.git
* [new branch] feature/bla ->feature/bla
Already on 'feature/bla'
Your branch is up-to-date with '
origin/feature/bla
'.
Summary of actions:
- A new remote branch 'feature/bla' was created
- The local branch 'feature/bla' was configured to track the remote branch
- You are now on branch 'feature/bla'
2) feature/bla remote push
catherineui-MacBook-Pro-3:python_sam catherine$ cp empty_test.py bla_1.py
catherineui-MacBook-Pro-3:python_sam catherine$ cp empty_test.py bla_2.py
catherineui-MacBook-Pro-3:python_sam catherine$ git branch
develop
* feature/bla
master
catherineui-MacBook-Pro-3:python_sam catherine$ git add bla_1.py
catherineui-MacBook-Pro-3:python_sam catherine$ git commit -m "feature 1"
[feature/bla 2d6c276] feature 1
1 file changed, 14 insertions(+)
create mode 100644 bla_1.py
catherineui-MacBook-Pro-3:python_sam catherine$ git add bla_2.py
catherineui-MacBook-Pro-3:python_sam catherine$ git commit -m "featrue 2"
[feature/bla 4a66f1d] featrue 2
1 file changed, 14 insertions(+)
create mode 100644 bla_2.py
catherineui-MacBook-Pro-3:python_sam catherine$
git push -u origin feature/bla
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 433 bytes | 0 bytes/s, done.
Total 4 (delta 2), reused 0 (delta 0)
To https://github.o.com/cathy/python_sam.git
247f4a8..4a66f1d feature/bla ->feature/bla
Branch feature/bla set up to track remote branch feature/bla from origin.
catherineui-MacBook-Pro-3:python_sam catherine$
3) hotfix start and finish (
from master
)
cathyui-MacBook-Pro-3:python_sam cathy$
git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
cathyui-MacBook-Pro-3:python_sam cathy$
git flow hotfix start 1.0.0
Switched to a new branch 'hotfix/1.0.0'
Summary of actions:
- A new branch 'hotfix/1.0.0' was created,
based on 'master'
- You are now on branch 'hotfix/1.0.0'
Follow-up actions:
- Bump the version number now!
- Start committing your hot fixes
- When done, run:
git flow hotfix finish '1.0.0'
cathyui-MacBook-Pro-3:python_sam cathy$ ll
total 16
-rw-r--r-- 1 cathy staff 0 3 6 14:16 README.md
-rw-r--r-- 1 cathy staff 157 3 6 14:24 empty_test.py
-rw-r--r-- 1 cathy staff 1795 3 6 14:16 parseXml.py
cathyui-MacBook-Pro-3:python_sam cathy$ cp empty_test.py hotfix_1.py
cathyui-MacBook-Pro-3:python_sam cathy$ git status
On branch hotfix/1.0.0
Untracked files:
(use "git add<file>..." to include in what will be committed)
hotfix_1.py
nothing added to commit but untracked files present (use "git add" to track)
cathyui-MacBook-Pro-3:python_sam cathy$
git add hotfix_1.py
cathyui-MacBook-Pro-3:python_sam cathy$
git commit -m "hotfix : 1.0.0"
[hotfix/1.0.0 43ad367] hotfix : 1.0.0
1 file changed, 14 insertions(+)
Merge branch 'hotfix/1.0.0'
create mode 100644 hotfix_1.py
cathyui-MacBook-Pro-3:python_sam cathy$ git branch
develop
feature/bla
hotfix 1.0.0 (for test)
* hotfix/1.0.0
master
Merge branch 'hotfix/1.0.0' into develop
cathyui-MacBook-Pro-3:python_sam cathy$
git push
...
Everything up-to-date
cathyui-MacBook-Pro-3:python_sam cathy$ git status
On branch hotfix/1.0.0
nothing to commit, working directory clean
cathyui-MacBook-Pro-3:python_sam cathy$
git flow hotfix finish 1.0.0
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
Merge made by the 'recursive' strategy.
hotfix_1.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 hotfix_1.py
Switched to branch 'develop'
Your branch is up-to-date with 'origin/develop'.
Merge made by the 'recursive' strategy.
hotfix_1.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 hotfix_1.py
Deleted branch hotfix/1.0.0 (was 43ad367).
Summary of actions:
- Latest objects have been fetched from 'origin'
- Hotfix branch has been merged into 'master'
- The hotfix was tagged '1.0.0'
- Hotfix branch has been back-merged into 'develop'
- Hotfix branch 'hotfix/1.0.0' has been deleted
cathyui-MacBook-Pro-3:python_sam cathy$
git branch
* develop
feature/bla
master
cathyui-MacBook-Pro-3:python_sam catherine$
git push
......
Counting objects: 6, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 370 bytes | 0 bytes/s, done.
Total 4 (delta 3), reused 0 (delta 0)
To https://github.o.com/cathy/python_sam.git
247f4a8..4eaf46c develop ->develop
247f4a8..282f63a master ->master
4) merge to feature/bla from develop
cathyui-MacBook-Pro-3:python_sam cathy$
git checkout feature/bla
Switched to branch 'feature/bla'
Your branch is up-to-date with 'origin/feature/bla'.
cathyui-MacBook-Pro-3:python_sam cathy$ git branch
develop
* feature/bla
master
cathyui-MacBook-Pro-3:python_sam cathy$
git merge develop
Merge made by the 'recursive' strategy.
hotfix_1.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 hotfix_1.py
cathyui-MacBook-Pro-3:python_sam cathy$ ll
total 40
-rw-r--r-- 1 cathy staff 0 3 6 14:16 README.md
-rw-r--r-- 1 cathy staff 157 3 6 14:51 bla_1.py
-rw-r--r-- 1 cathy staff 157 3 6 14:51 bla_2.py
-rw-r--r-- 1 cathy staff 157 3 6 14:24 empty_test.py
-rw-r--r-- 1 cathy staff 157 3 6 14:51
hotfix_1.py
-rw-r--r-- 1 cathy staff 1795 3 6 14:16 parseXml.py
cathyui-MacBook-Pro-3:python_sam cathy$
cp bla_1.py bla_3_merge_hotfix.py
cathyui-MacBook-Pro-3:python_sam cathy$
git status
On branch feature/bla
Your branch is ahead of 'origin/feature/bla' by 3 commits.
(use "git push" to publish your local commits)
Untracked files:
(use "git add<file>..." to include in what will be committed)
bla_3_merge_hotfix.py
nothing added to commit but untracked files present (use "git add" to track)
cathyui-MacBook-Pro-3:python_sam cathy$ git add bla_3_merge_hotfix.py
cathyui-MacBook-Pro-3:python_sam cathy$ git commit -m "merge_hotfix and commit new file"
[feature/bla f1de82f] merge_hotfix and commit new file
1 file changed, 14 insertions(+)
create mode 100644 bla_3_merge_hotfix.py
cathyui-MacBook-Pro-3:python_sam cathy$ git push
....
Counting objects: 6, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 490 bytes | 0 bytes/s, done.
Total 4 (delta 2), reused 0 (delta 0)
To https://github.o.com/cathy-lyn/python_sam.git
4a66f1d..f1de82f feature/bla ->feature/bla