User Tools

Site Tools


docu:csheet:sysadm:script:git:merge_upstream

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
docu:csheet:sysadm:script:git:merge_upstream [2021/10/20 07:16] admindocu: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'yet)
 git clone https://git.nogafam.es/nogafam/instante-social.git git clone https://git.nogafam.es/nogafam/instante-social.git
 cd instante-social cd instante-social
  
-// on the project root path, add a new remote called -upstream- +on the project root path, add a new remote called "upstream" 
-//  (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://github.com/mastodon/mastodon.git git remote add upstream https://github.com/mastodon/mastodon.git
  
-// get all upstream data and pull -mainbranch +# this previous steps, will only be done ONCE.  
-//  (mastodon,s main branch is called -main-, not -master-)+#  If you already have remotes configured, skip previous steps 
 + 
 +get all upstream data and pull "mainbranch 
 + (mastodon's main branch is called "main", not "master")
 git fetch upstream git fetch upstream
 git pull upstream main git pull upstream main
  
-// now, if there is unexpected changes (conflicts), you will have to merge +now, if there is unexpected changes (conflicts), you will have to merge 
-//  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 
-//  IMPORTANT: when not, solve conflicts manually, and use "git add". Use at your own risk. + IMPORTANT: when not, solve conflicts manually, and use "git add". Use at your own risk. 
-// +# 
-// reset changes on conflicted files+reset changes on conflicted files
 git status | grep -i 'both modified:' | awk '{print $NF}' | xargs git reset git status | grep -i 'both modified:' | awk '{print $NF}' | xargs git reset
-// restore those files to put your changes first+restore those files to put your changes first
 git status | grep -A 10000 'git restore' | tail -n+2 | awk '{print $NF}' | xargs git restore git status | grep -A 10000 'git restore' | tail -n+2 | awk '{print $NF}' | xargs 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 "origin" + (we obviate the fact that the main remote is called "origin" 
-//   and also obviate the main branch is called the same: "main")+  and also obviate the main branch is called the same: "main")
 git commit git commit
 git push origin main git push origin main
  
 </code> </code>
docu/csheet/sysadm/script/git/merge_upstream.1634714197.txt.gz · Last modified: 2021/10/20 07:16 by admin