Skip to content

Instantly share code, notes, and snippets.

@Makio64
Last active March 7, 2017 11:12
Show Gist options
  • Save Makio64/61cc1ade9f6dc0e4e1131becce920bff to your computer and use it in GitHub Desktop.
Save Makio64/61cc1ade9f6dc0e4e1131becce920bff to your computer and use it in GitHub Desktop.
# Git Worklow
### branches
- **develop** : *remote* branch with all versions
- **local** : *local* branch with local version
### workflow
1. After cloning the project, create a **local** branch
2. Always work on **local**, but never push it on remote server
3. **commit** you work and describe it as mush as possible :
`git add -A; git commit -m "category/feature : what you have done"`
4. When you want to push your commits, you have to rebase **local** on **master** (to get other people commits) and after resolving rebase issues, you can merge **local** with **master** and push it on the remote server :
1. `git checkout master` : go on **master**
2. `git pull origin master` : update **master** from remote server
3. `git checkout local` : go back on **local**
4. `git rebase master` : rebase **local** on **master**
5. if you have rebase issues, fix it then continue : `git add -A; git rebase continue`
6. `git checkout master` : now **local** is up-to-date, go back on **master**
7. `git merge local` : merge **master** with **local**
8. `git push origin master` : now you can push **master** on remote server
9. `git checkout local` : don't forget to go back on **local**
To simplify this process :
- `tools/hack` : 4.1 to 4.4
- if you have rebase issues, fix it then continue : `git add -A; git rebase --continue;`
- `tools/ship` : 4.6 to 4.9
//------------------------------------------------ tools/hack
#!/bin/sh -x
# Git workflow hack script from: http://jonrohan.me/guide/git/dead-simple-git-workflow-for-agile-teams/
ref=$(git symbolic-ref HEAD 2> /dev/null) || exit 0
CURRENT="${ref#refs/heads/}"
if [ -n "$1" ]; then
master_branch=$1
else
master_branch="master"
fi
git checkout ${master_branch}
git pull origin ${master_branch}
git checkout ${CURRENT}
git rebase ${master_branch}
//------------------------------------------------ tools/ship
#!/bin/sh -x
# Git workflow ship script from: http://jonrohan.me/guide/git/dead-simple-git-workflow-for-agile-teams/
ref=$(git symbolic-ref HEAD 2> /dev/null) || exit 0
CURRENT="${ref#refs/heads/}"
if [ -n "$1" ]; then
master_branch=$1
else
master_branch="master"
fi
git checkout ${master_branch}
git merge ${CURRENT}
git push origin ${master_branch}
git checkout ${CURRENT}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment