Looking for something totally different on the internet, I got to see that video about a "Git Rebase" workflow that is different from the "standard" "Git Merge/Pull Request" workflow.
The developer on the video is making a pretty good job at explaining clearly why it is interesting, and how it is working in practice.
That looks pretty interesting as indeed a Git tree can become really huge when using the Pull Request/Merge workflow.
I want to have your feedback, feeling about that Git workflow.
Do you used it on your project? Wether you are working alone on your project or you are collaborating with other developers.
I would be happy to have your feedback about what you feel about the Git workflow.
I used it quickly on a test repo to see how it is working and it is petty interesting.
If you want to test it, you can use the following script to have a local git folder ready so you can experiment the git rebase workflow :
#!/bin/zsh git branch "feature/1" git checkout "feature/1" echo "Feature 1 : " >> README.md echo "1" >> README.md git commit -a -m "Feature 1 : 1" echo "2" >> README.md git commit -a -m "Feature 1 : 2" echo "3" >> README.md git commit -a -m "Feature 1 : 3" git checkout "master" echo "Master" >> README.md echo "1" >> README.md git commit -a -m "Master 1 : 1"
Then, to use the Git Rebase workflow, you can try :
# Checkout the Feature branch. git checkout feature/1 # Rebase the Feature branch onto "master" the interactive way. git rebase -i master #Resolve conflicts # Continue rebasing now that the conflicts are resolved. # Squash your commits into the first one and reword the first commit to explain all the changes from the 3 commits modifications. git rebase --continue # Checkout the "master" branch. git checkout master # Rebase the master branch onto "master". git rebase feature/1 # Delete the Feature branch. git branch -D feature/1
If you want to have the same result using git merge, you can try :
# Move to the master branch. git checkout master # Merge the "feature/1" branch and squash the commits. git merge --squash feature/1 #Resolve conflicts # Commit your changes and add a single commit message for all your commits. # You can omit the "-m" to have a template popping up based on your previous commit messages. git commit -m "Feature 1 : 1, 2 et 3" # Delete the "feature/1" branch that is no longer needed. git branch -D feature/1