I use github to update a repository using git or composer. But there are some small parts I need to "patch"/modify to the core every time I do a git pull.
What is the best way to manage this so I can always apply my changes on every update, and also keep my changes stored somewhere in my forked repository if I accidently delete everything on local? ONly storing these changes on local and just denying the overwrite does not seem secure in case of local data loss.
This is a common situation: Maintaining local changes while regularly updating with remote changes. The standard way to handle this is:
git config branch.BRANCHNAME.rebase true
, where BRANCHNAME is the local branch you use Now, everytime you run git pull
, git will rebase your branch onto the new state of the remote branch. This means in detail it will:
The last step may fail with a merge conflict if there are conflicting changes - then you'll have to resolve by hand.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.