TL DR
Use git stream .
It will remove questions and automate some of the things you ask for. When you are familiar with git thread and branching, etc., you can easily select something differently - or manually.
Changes to be reflected on my home machine as well
On your imac push / pull to not-master and on your home computer, push / pull from a non-master.
Where "non-master" is any branch that you are currently working on.
On dev branches
Before you, your workflow should help, without hindering development. For instance. what if two developers collaborate on the same task - do you want to make them work in different industries? Function areas probably make more sense; there is nothing wrong with having user branches.
Separate production branch
However, you do this - your live application should pull it out of a well-known stable tag / branch and usually don’t directly click on the master , because breaking things is part of development, but hacking the code from which your live application will pull is what you absolutely want to avoid. You should be able to pull your live installation without any doubt, at any time, that you can pull the broken code. If you use the Continuous Integration Server server , you can easily automate merging with the development branch to handle if all tests pass and even automatically deploy.
When the branch is completed with
All doubts about the workflow are one and the same. when the branch is completed, you merge it into your main branch.
i.e.
$ git branch working-on-this master $ git add ... $ git commit ... $
And when the time comes:
$ git checkout master $ git pull $ git merge working-on-this $ git push $ git branch -d working-on-this $ git push $REMOTE :working-on-this
You do not explicitly delete all branches on other machines; however, any user can at any time execute:
$ git branch --merged master
which, if the branch is finished, will look like this:
$ git branch --merged master master working-on-this $ git branch -d working-on-this
This indicates that it can be safely removed. In any case, git branch -d triggers a warning and aborts if you try to delete a branch that is not merged with the branch you are in when you execute the command.
If you find that you have several remote branches that are thought to have already completed, you can clear them with one command:
$ git remote prune -n origin
The -n flag means that it will only report which branches it is going to delete - delete this flag to actually delete the obsolete deleted branches
If you have several developers working in the same branch (sharing) communication is key , do not rely on the workflow, actively talk about deleting things before leaving one of your teams working in a (presumably) completed branch.
Branch Lock Permissions Limit
Yes, you can do it, but do you really want it? You are better off using communications and conventions.
Some suggestions:
- anyone can create a remote branch
- nobody commits / merges with the master (only the lead developer does this)
- nobody removes the remote branch (only the lead developer does this)
- nobody trims the remote server (only the lead developer does this)
Anyone can do any of the above at any time, but believing that you trust your team as a whole, there is no reason to actually prohibit developers from stopping them from doing this - there will probably be times when they need to be ranked , and the rules prevent this, while the convention does not.