This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
docu:csheet:sysadm:script:git:merge_upstream [2021/10/20 07:16] – admin | docu:csheet:sysadm:script:git:merge_upstream [2021/10/20 07:19] (current) – admin | ||
---|---|---|---|
Line 5: | Line 5: | ||
<code bash> | <code bash> | ||
- | // clone your repo (if you didnt yet) | + | # clone your repo (if you didn' |
git clone https:// | git clone https:// | ||
cd instante-social | cd instante-social | ||
- | // on the project root path, add a new remote called | + | # on the project root path, add a new remote called |
- | // (a standard way to call it, but you can call it whatever) | + | # (a standard way to call it, but you can call it whatever) |
git remote add upstream https:// | git remote add upstream https:// | ||
- | // get all upstream data and pull -main- branch | + | # this previous steps, will only be done ONCE. |
- | // | + | # If you already have remotes configured, skip previous steps |
+ | |||
+ | # get all upstream data and pull "main" | ||
+ | # | ||
git fetch upstream | git fetch upstream | ||
git pull upstream main | git pull upstream main | ||
- | // now, if there is unexpected changes (conflicts), | + | # now, if there is unexpected changes (conflicts), |
- | // this snippets can help you automate the process if you want HEAD of all conflicts | + | # this snippets can help you automate the process if you want HEAD of all conflicts |
- | // | + | # |
- | // | + | # |
- | // reset changes on conflicted files | + | # reset changes on conflicted files |
git status | grep -i 'both modified:' | git status | grep -i 'both modified:' | ||
- | // restore those files to put your changes first | + | # restore those files to put your changes first |
git status | grep -A 10000 'git restore' | git status | grep -A 10000 'git restore' | ||
- | // now commit your changes to do the merge and push changes | + | # now commit your changes to do the merge and push changes |
- | // (we obviate the fact that the main remote is called " | + | # (we obviate the fact that the main remote is called " |
- | // and also obviate the main branch is called the same: " | + | # and also obviate the main branch is called the same: " |
git commit | git commit | ||
git push origin main | git push origin main | ||
</ | </ |