Long time software architect, CTO Authress, creating application security plug-ins for any software application with Authress. Talk to me about security in microservices or service authorization.
Wow, after getting some links here, I was sure as hell expecting to have an automated solution, like a scheduled task to automate this, or a link to a github article on how to set up fork syncing.
... Disappointed.
What's a much better thing to do is directly track upstream instead of origin.
You can even overwrite the origin master ref locally, so that it is always the same as the source:
[remote "upstream"]
url = git@github.com:source/original-repository.git
fetch = +refs/heads/*:refs/remotes/upstream/*
# This next line always overwrites the origin ref to the upstream ref
# This is purely optional
fetch = +refs/heads/master:refs/remotes/origin/master
You'll need to match sure that you always git fetch --all, but that can be easily solved with a git alias.
Also if you are using Gitlab, there is already a feature to automatically support this (from three years ago: about.gitlab.com/blog/2016/12/01/h...)
Long time software architect, CTO Authress, creating application security plug-ins for any software application with Authress. Talk to me about security in microservices or service authorization.
By default your local branch master is set to track changes from origin. However what you really want is master tracking changes from upstream. So I'm just suggesting to ignore origin/master as a mindset shift, and then everything works out as you would expect. Sure your remote origin/master is wrong, but who cares.
Thank you for sharing that! I hadn’t seen that before, and it’s always nice to learn new techniques. I can definitely see the benefit of an automated solution as well. Food for thought 🤔
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Wow, after getting some links here, I was sure as hell expecting to have an automated solution, like a scheduled task to automate this, or a link to a github article on how to set up fork syncing.
... Disappointed.
What's a much better thing to do is directly track
upstream
instead oforigin
.Then just ignore your master branch fetched from origin. If you want to know how to set this up from the CLI:
You can even overwrite the origin
master
ref locally, so that it is always the same as the source:You'll need to match sure that you always
git fetch --all
, but that can be easily solved with a git alias.Also if you are using Gitlab, there is already a feature to automatically support this (from three years ago: about.gitlab.com/blog/2016/12/01/h...)
wow :O I have to try this, not grasped it ...
master branch fetched from origin
, why I'd fetch from origin?By default your local branch
master
is set to track changes fromorigin
. However what you really want ismaster
tracking changes fromupstream
. So I'm just suggesting to ignoreorigin/master
as a mindset shift, and then everything works out as you would expect. Sure your remoteorigin/master
is wrong, but who cares.Thank you for sharing that! I hadn’t seen that before, and it’s always nice to learn new techniques. I can definitely see the benefit of an automated solution as well. Food for thought 🤔