"Git is easy to learn and has a tiny footprint with lightning fast performance."
That said you can always learn more.
The more you undertand and use something the more transparent it will be.
If you find yourself struggling with a tool you need to work more with it. Practice.
I highly suggest you practice with personal repos.
Pro Git http://git-scm.com/book
-
Atlassian Git Tutorial
-
Learn Version Control with Git
A step-by-step course for the complete beginner
-
Git From the Bottom
-
GitX
-
Remember to view 'all branches'
-
Command line
-
$ git log –all –oneline –graph –decorate
Become comfortable with the following:
- Creating a repo
- Branching
- Merging (different types)
- Deleting branches local and remote
- Pushing to origin and tracking
- Creating a local tracking branch
- There are other workflows
- This isn't necessarilly the best
- It is popular so you will find it elsewhere
- You may be familar
- It's simple enough and if followed everyone will be comfortable in all the repos
http://nvie.com/posts/a-successful-git-branching-model/
- The Git Flow branch model is based on two long running branches.
- Master and develop exist while features and releases branch off of these and are merged back.
- Features branch off and back onto develop
- Releases branch off of develop and are merged back into develop and master
- Releases are pushed to production
- Releases at the minimum include a bumped version number and rollbacks are to previous release branches
- The idea of hotfixes is ignored. Last minute fixes can be handled on the release branch
- There can be exceptions but you should know what you are doing
-
Initialize the repo to include master and devlop
- Clean repo
- Get rid of old branches including old 'dev' branches
- Remove old remote branches (this can be done in a script)
- Merge to master and make sure things are up todate
-
Initialize Git Flow
- Create develop
- Master and develop
-
Use feature and release branches only
-
These are scripts that help automate some of the Git Flow tasks.
-
I recommend getting a good understanding of Git and the ideas behind Git Flow first
-
Then these will make sense and the 'magic' then do will be understood.
-
Original
-
git-flow
-
Better
-
I wanted to be able to support –no-ff on develop merges
-
git-flow-avh
- I have these to further reduce the amount of details I need to remember
- The git-finish-release is the most important
- It has the --no-ff -k to leave the feature branch and merge it without a fast forward
-
Add to local bashrc
function git-flow { echo "git-start-feature <feature-name>" echo "git-finish-feature <feature-name>" echo "git-start-release <release-name>" echo "git-finish-relase <release-name>" } function git-start-feature { echo "todo" if [ -z "$1" ] then echo "Enter feature name" else echo $1 git flow feature start $1 fi } function git-finish-feature { if [ -z "$1" ] then echo "Enter feature name" else echo $1 git flow feature finish --no-ff -k $1 fi } function git-start-release { echo "todo" if [ -z "$1" ] then echo "Enter release name" else echo $1 git flow release start $1 fi } function git-finish-release { if [ -z "$1" ] then echo "Enter release name" else echo $1 git flow release finish -k $1 fi }
-
Install git-flow-avh
- https://github.com/petervanderdoes/gitflow-avh
- brew install git-flow-avh
-
Install Local Functions (above)
-
Initialize your repos
- Make sure everything is up to date on master
- If you have old 'dev' branches get rid of them
- If you have a 'develop' make sure it is merged to master
- git flow init
-
Use features for each development task
- git flow feature start FEATURE_NAME
- git flow feature finish FEATURE_NAME
-
Use release for 'releases'
-
Release are version numbers
-
RELEASE_NUMBER = 0.1.3
-
git flow release start RELEASE_NUMBER
-
bump_version
-
commit
-
git flow release public RELEASE_NUMBER
-
or
-
push origin -u release/RELEASE_NUMBER
-
origin/release/RELEASE_NUMBER is pushed to productions
-
After release is pushed then finish it
-
This will merge back into master and develop
-
git flow release finish RELEASE
-