Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suggest fast forwarding when pulling from remote #1

Merged
merged 2 commits into from
Oct 25, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ Each new feature should reside in its own branch using `feature/` prefix, But in
#### Creating a feature branch

`git checkout master`
`git pull origin master`
`git pull --ff-only origin master`
`git checkout -b feature/my_feature`

#### Finishing a feature branch

When you’re done with the development work on the feature, the next step is to merge the `feature/my_feature` into `staging` to show it Client and QA for their approval.

`git checkout staging`
`git pull origin staging`
`git pull --ff-only origin staging`
`git merge --no-ff feature/my_feature`
`git push origin staging`

Expand All @@ -45,7 +45,7 @@ When you’re done with the development work on the feature, the next step is to
After Client's approval, the next step is to merge the `feature/my_feature` into `master` to deploy it production server

`git checkout master`
`git pull origin master`
`git pull --ff-only origin master`
`git merge --no-ff feature/my_feature`
`git push origin master`

Expand All @@ -61,22 +61,28 @@ Once it get deployed to prodction, the next step is to delete local and remote b
`hotfix` branches are used to quickly patch for production. This branch that should fork directly off of `master`. As soon as the fix is complete, it should be merged into both `master` and `staging`.

`git checkout master`
`git pull origin master`
`git pull --ff-only origin master`
`git checkout -b hotfix/my_fix`

Similar to finishing a feature branch, a hotfix branch gets merged into both `master` and `staging`.

`git checkout master`
`git pull origin master`
`git pull --ff-only origin master`
`git merge --no-ff hotfix/my_fix`
`git push origin master`

`git checkout staging`
`git pull origin staging`
`git pull --ff-only origin staging`
`git merge --no-ff hotfix/my_fix`
`git push origin staging`


## Things to note
* Always use `--ff-only` when pulling changes from remote, otherwise it creates a merge commit, which pollutes history. Then you can rebase your local branch over remote and push accordingly.
* If a change is going to take 3 or more commits, it should not be in a hotfix branch
* When doing a merge you should always use `--no-ff` to create an additional commit. This helps to group related commits together.


## Useful git configuration
Git configuration can help you a lot with the projects. Here are a few useful options-
* `push.default=current` - When typing `git push` without any branch name, it will push the current branch automatically.
Expand Down