개발

[git flow]feature

수학소년 2023. 8. 8. 12:20

원격저장소는 git flow init 안해도 됌

개발하는 사람의 로컬 repository에 git flow

 

1. 개발자1 와서 clone하고 git flow init

git clone [repository url]

git flow init -d

그럼 master만 있던 branch목록에 develop이 생길꺼임

 

2. 개발자2 와서 똑같은 작업

git clone [repository url]

git flow init -d

 

3. 개발자1이 개발시작 해야 해서 flow start

git flow feature start feature0

그러면 "feature/feature0"라는 branch가 만들어짐

$ git flow feature start feature4        
Switched to a new branch 'feature/feature4'

Summary of actions:
- A new branch 'feature/feature4' was created, based on 'develop'
- You are now on branch 'feature/feature4'

Now, start committing on your feature. When done, use:

     git flow feature finish feature4
$ git branch  
  develop
* feature/feature4
  master

여기다 대고 신나게 commit하면 됌

 

4. 개발자1이 신나게 개발 후 commit

git add .

git commit -m "..."

 

5. 개발자1 작업이 끝남

git flow feature finish feature0

내 로컬 repository develop branch에 merge돼어 있음

$ git flow feature finish feature4       
Switched to branch 'develop'
Updating 9ffbff1..2cdf082
Fast-forward
 feature4 | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 feature4
Deleted branch feature/feature4 (was 2cdf082).

Summary of actions:
- The feature branch 'feature/feature4' was merged into 'develop'
- Feature branch 'feature/feature4' has been locally deleted
- You are now on branch 'develop'
$ git log --oneline
2cdf082 (HEAD -> develop) feature4
9ffbff1 (origin/develop) conflict
....
$ git branch 
* develop
  master

 

6. 원격저장소 develop branch로 push

git push origin develop

 

이슈

feature/feature0 branch에 여러 commit이 쌓여있을텐데,, 이걸 develop이나 master로 push한다면?

내 로컬 develop이나 로컬 master는 변화가 없으니 최신파일이겠지? 어차피 push안됌

 

git flow feature finish feature0

=

git checkout develop

git merge feature/feature0

git branch -d feature/feature0

 

publish된 기능이 있을 때

$ git flow feature finish feature5       
Branches 'develop' and 'origin/develop' have diverged.
And local branch 'develop' is ahead of 'origin/develop'.
Switched to branch 'develop'
Updating 3f8b52d..40b4494
Fast-forward
 feature5 | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 feature5
To D:\src\vscode\gitflow\server.git
 - [deleted]         feature/feature5
Deleted branch feature/feature5 (was 40b4494).

Summary of actions:
- The feature branch 'feature/feature5' was merged into 'develop'
- Feature branch 'feature/feature5' has been locally deleted; it has been remotely deleted from 'origin'
- You are now on branch 'develop'

(로컬)feature/feature5가 (로컬)develop에 merge돼고(- The feature branch 'feature/feature5' was merged into 'develop')

(로컬)feature/feature5가 삭제되고; (원격)feature/feature5가 삭제되고 (- Feature branch 'feature/feature5' has been locally deleted; it has been remotely deleted from 'origin')