From 79e324083baab1f06da9b6884abf18770bf553b0 Mon Sep 17 00:00:00 2001 From: Mridul Aggarwal Date: Thu, 25 Oct 2018 23:38:52 +0530 Subject: [PATCH] suggest fast forwarding when pulling from remote --- README.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e397e5f..9dfc336 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ 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 @@ -36,7 +36,7 @@ Each new feature should reside in its own branch using `feature/` prefix, But in 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` @@ -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` @@ -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. + + ## Summary - A `staging` branch is created from `master`