Reputation: 5135
My workflow is as follows:
feature/foo
from develop
.feature/foo
Githubdevelop
branch through the GitHub Pull Request menu.Usually, I never merge any commits to master/develop branches in local.
I have two local branches, which always pull from the origin, and never be pushed.
My question is, is there a software or command-line tools to automatically sync that two branches with origin server at a certain interval and keep them fresh, so I don't have to pull them manually and save the time.
Upvotes: 1
Views: 547
Reputation: 7457
In the scenario where your local develop and master are "slaves" of the remote, I find it quicker to just delete the local branch and recreate it from the fetched remote branch. I even do this when working in a team and we do merge locally into develop. Before merging I throw away develop and check it out again from origin/develop
with the other team members latest changes fetched.
Most clients (SourceTree, Git Extensions, Tower) feature an automated fetch. Therefore you only need to script the "delete and create-branch" from the locally fetched remote branch which will be always fresh.
As others have mentioned the issue of conflicts means no software would include an automated pull (fetch + merge). But automated fetch alone is risk-free, so most do include that.
However - why bother even keeping a local branch if you're never going to use it? Why not just create your local feature branches from the remote branch?
e.g. you create a new branch feature/foo
from origin/develop
instead. With auto-fetch, it will always be up to date.
Upvotes: 2
Reputation: 72795
You can write a small script to automate it. However, what will you do if your branch has a merge conflict with develop
when you try to merge back? How do you resolve it? Ideally, you should pull in changes from develop into your own branch, make sure it works and then push it back rather than rely on automation or the GitHub website controls.
Upvotes: 1