sh #git#git-flow
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh #git#git-flow相关的知识,希望对你有一定的参考价值。
## Initialize
gitflow | git
--------|-----
`git flow init` | `git init`
| `git commit --allow-empty -m "Initial commit"`
| `git checkout -b develop master`
## Connect to the remote repository
gitflow | git
--------|-----
_N/A_ | `git remote add origin git@github.com:MYACCOUNT/MYREPO`
## Features
### Create a feature branch
gitflow | git
--------|-----
`git flow feature start MYFEATURE` | `git checkout -b feature/MYFEATURE develop`
### Share a feature branch
gitflow | git
--------|-----
`git flow feature publish MYFEATURE` | `git checkout feature/MYFEATURE`
| `git push origin feature/MYFEATURE`
### Get latest for a feature branch
gitflow | git
--------|-----
`git flow feature pull origin MYFEATURE` | `git checkout feature/MYFEATURE`
| `git pull --rebase origin feature/MYFEATURE`
### Finalize a feature branch
gitflow | git
--------|-----
`git flow feature finish MYFEATURE` | `git checkout develop`
| `git merge --no-ff feature/MYFEATURE`
| `git branch -d feature/MYFEATURE`
### Push the merged feature branch
gitflow | git
--------|-----
_N/A_ | `git push origin develop`
| `git push origin :feature/MYFEATURE` _(if pushed)_
## Releases
### Create a release branch
gitflow | git
--------|-----
`git flow release start 1.2.0` | `git checkout -b release/1.2.0 develop`
### Share a release branch
gitflow | git
--------|-----
`git flow release publish 1.2.0` | `git checkout release/1.2.0`
| `git push origin release/1.2.0`
### Get latest for a release branch
gitflow | git
--------|-----
_N/A_ | `git checkout release/1.2.0`
| `git pull --rebase origin release/1.2.0`
### Finalize a release branch
gitflow | git
--------|-----
`git flow release finish 1.2.0` | `git checkout master`
| `git merge --no-ff release/1.2.0`
| `git tag -a 1.2.0`
| `git checkout develop`
| `git merge --no-ff release/1.2.0`
| `git branch -d release/1.2.0`
### Push the merged feature branch
gitflow | git
--------|-----
_N/A_ | `git push origin master`
| `git push origin develop`
| `git push origin --tags`
| `git push origin :release/1.2.0` _(if pushed)_
## Hotfixes
### Create a hotfix branch
gitflow | git
--------|-----
`git flow hotfix start 1.2.1 [commit]` | `git checkout -b hotfix/1.2.1 [commit]`
### Finalize a hotfix branch
gitflow | git
--------|-----
`git flow hotfix finish 1.2.1` | `git checkout master`
| `git merge --no-ff hotfix/1.2.1`
| `git tag -a 1.2.1`
| `git checkout develop`
| `git merge --no-ff hotfix/1.2.1`
| `git branch -d hotfix/1.2.1`
### Push the merged hotfix branch
gitflow | git
--------|-----
_N/A_ | `git push origin master`
| `git push origin develop`
| `git push origin --tags`
| `git push origin :hotfix/1.2.1` _(if pushed)_
## References
- http://nvie.com/posts/a-successful-git-branching-model/
- https://help.github.com/articles/using-pull-requests#shared-repository-model
- Personal experience
- http://danielkummer.github.io/git-flow-cheatsheet/
- [JamesMGreene / gitflow-breakdown.md](https://gist.github.com/JamesMGreene/cdd0ac49f90c987e45ac)
RELEASE_NAME='1.2/3'
#release/[MAJOR].[MINOR]/[REVISION]
#Exemplo:
#release/1.2/3
# use the data as release may be ok
#RELEASE_NAME='2016/07/'
#git flow release list
git flow release start $RELEASE_NAME
git flow release publish $RELEASE_NAME
git flow release finish $RELEASE_NAME
#or
git flow release finish -F -p $RELEASE_NAME
#git checkout master
#git fetch origin master #Latest objects have been fetched from 'origin'
#git merge –no-ff $RELEASE_NAME #Release branch has been merged into 'master'
#git tag -a $RELEASE_NAME #The release was tagged '$RELEASE_NAME'
#git push origin master
#git checkout develop
#git fetch origin develop
#git merge –no-ff $RELEASE_NAME #Release branch has been back-merged into 'develop'
#git push origin develop #'develop', 'master' and tags have been pushed to 'origin'
#git branch –d $RELEASE_NAME #Release branch 'release/$RELEASE_NAME' has been deleted
FEATURE_NAME='bootstrap_project'
# git flow feature start <name> [<base>]
git flow feature start $FEATURE_NAME
#git branch feature/ReadmeAdd
#git checkout feature/ReadmeAdd
touch README
git add README
git commit -m "Added readme file with some text"
git flow feature publish $FEATURE_NAME
#git push origin feature/$FEATURE_NAME
#git config branch.feature/$FEATURE_NAME.remote origin
#git config branch.feature/$FEATURE_NAME.merge refs/heads/feature/$FEATURE_NAME
#git checkout feature/$FEATURE_NAME
#git flow feature pull [alias] [featureName]
git flow feature pull origin $FEATURE_NAME
#First time feature pull:
#git fetch origin feature/$FEATURE_NAME
#git branch --no-track feature/$FEATURE_NAME FETCH_HEAD
#git checkout feature/$FEATURE_NAME
#Subsequent feature pull
#git pull origin feature/$FEATURE_NAME
# before git flow finish
# git checkout develop # you should probably be here already
git pull origin develop
#git flow feature finish [featureName]
git flow feature finish $FEATURE_NAME
#git checkout develop
#git merge –no-ff feature/$FEATURE_NAME
#git branch -d feature/$FEATURE_NAME
# after git flow finish
git push origin :feature/$FEATURE_NAME #if you want to remove remote branch
# https://yakiloo.com/getting-started-git-flow/
GIT_REPO='/var/www/tpassos/git/demo-repo'
cd $GIT_REPO
git flow init
#No branches exist yet. Base branches must be created now.
#Branch name for production releases: [master]
#Branch name for "next release" development: [develop]
#How to name your supporting branch prefixes?
#Feature branches? [feature/]
#Release branches? [release/]
#Hotfix branches? [hotfix/]
#Support branches? [support/]
#Version tag prefix? []
#for existing repositories may be good to check the existent branches
#git branch -a | grep feature
#git branch -a | grep release
#git branch -a | grep hotfix
#git branch -a | grep support
#git branch -a | grep tags
git push origin develop
git pull origin develop
GIT_REPO_REMOTE='/var/www/tpassos/git/demo-repo.git'
GIT_REPO='/var/www/tpassos/git/demo-repo'
# cerate a remote git repository
mkdir -p $GIT_REPO_REMOTE
cd $GIT_REPO_REMOTE
git init --bare --shared
# create a local copy of the remote's repo
mkdir -p $GIT_REPO
cd $GIT_REPO
git init
git remote add origin $GIT_REPO_REMOTE
git remote -v
# OR
# git clone the remote repo
git clone $GIT_REPO_REMOTE $GIT_REPO
#http://danielkummer.github.io/git-flow-cheatsheet/
以上是关于sh #git#git-flow的主要内容,如果未能解决你的问题,请参考以下文章