Dynamic Doughnut Graph Using Laravel Vue Component
May 24, 2021How To Charge For A Website
June 7, 2021This Git workflow can be used collaboratively or individually. This workflow will; ensure your individual changes are be preserved, makes sure that the main branch is always in a state which can successfully compile.
The goals of committing are to:
- Commit as often as you can as you can, as you have accomplished a reasonable amount of progress that can be described.
- Only commit if your project can be compiled.
- For your commit to be as small as possible, and for the message to describe what has been done.
So let’s describe the git workflow:
This assumes your git repository is initialised and that your main line of development is called master, and that your remote is origin.And we are develeloping a feature called login.
- Create a private branch - this branch will stay on your local machine and will not be pushed to the remote, we can call this branch the same name as our feature.
git branch login
- Switch to your branch - this is where we will do our development related to the feature, until we are ready to add the feature into the main line of development (master branch).
git checkout login
- Continue to develop your login feature here, making commits according to the goals above
- Commit all your work the the branch
git add .
git commit -m ‘your description for the commit’
- Fetch and rebase changes from the remote to this branch. Git pull will operate on the node that HEAD points to, so you must be on your private branch login
git pull origin master --rebase
- When you have finished developing your feature and have nothing left to commit, we can add our feature to the main line of development (master branch)
- Fetch and rebase the changes, again for your private branch
git pull origin master --rebase
- Checkout to the main line of development
git checkout master
- Merge your work on the private branch to the main line of development (master branch). This will always be a fast-forward commit, meaning you will not have a separate commit for the merge, nor will you have any conflicts!
git merge login
- Push to your remote
git push origin master
- Delete your private branch (If you want to)
git branch -d login
- Fetch and rebase the changes, again for your private branch
- If you’re ready to start a new feature. Go back to step 1!
2 Comments
Great topic and interesting concept on rebasing a branch to the main line rather than a traditional approach of merging a branch in.
Thanks! We are rebasing the main branch onto our private branch, then merging our private branch back into main. This way it’ll always be a fast forward commit with no conflicts when we merge. Rebasing our private branch to the master would cause a change to the master branch, something we don’t want until our feature is done… then we just merge the two.