general:git
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
general:git [2021/12/20 09:11] – sunkan | general:git [2023/01/30 08:53] (current) – sunkan | ||
---|---|---|---|
Line 17: | Line 17: | ||
< | < | ||
$ git format-patch -k -o ~/ | $ git format-patch -k -o ~/ | ||
+ | </ | ||
+ | |||
+ | Check if a forced update is pending | ||
+ | < | ||
+ | $ git fetch --dry-run | ||
+ | remote: Enumerating objects: 26, done. | ||
+ | remote: Counting objects: 100% (26/26), done. | ||
+ | remote: Compressing objects: 100% (15/15), done. | ||
+ | remote: Total 26 (delta 12), reused 21 (delta 7), pack-reused 0 | ||
+ | Unpacking objects: 100% (26/26), done. | ||
+ | From https:// | ||
+ | + 1ec508d...c046c5f 1.x -> origin/ | ||
+ | |||
</ | </ | ||
Update local branch when we know there is going to be a forced update | Update local branch when we know there is going to be a forced update | ||
< | < | ||
- | $git checkout master # Needs to be performed before doing fetch | + | $ git checkout master # Needs to be performed before doing fetch |
- | $git fetch | + | $ git fetch |
- | $git branch -D 1.x | + | $ git branch -D 1.x |
- | $git checkout -b mybranch-1.x origin/1.x | + | $ git checkout -b mybranch-1.x origin/1.x |
</ | </ | ||
Line 30: | Line 43: | ||
< | < | ||
$ cat ~/ | $ cat ~/ | ||
+ | </ | ||
+ | |||
+ | Script to automate fetching and re-applying patches | ||
+ | <code bash> | ||
+ | #!/bin/sh | ||
+ | |||
+ | localbranch=mybranch-1.x | ||
+ | remotebranch=1.x | ||
+ | patchdir=~/ | ||
+ | repodir=~/ | ||
+ | |||
+ | # Generate patches | ||
+ | # git format-patch -k -o " | ||
+ | |||
+ | ( cd $repodir | ||
+ | # Apply patches | ||
+ | git checkout master # Needs to be run before fetch | ||
+ | git branch -D $localbranch-old | ||
+ | git branch -m $localbranch $localbranch-old | ||
+ | git fetch | ||
+ | git checkout -b $localbranch origin/ | ||
+ | cat " | ||
+ | ) | ||
+ | </ | ||
+ | |||
+ | ====== Update intermediary bare repo ====== | ||
+ | Found some good info here. \\ | ||
+ | [[https:// | ||
+ | |||
+ | First fetch from the upstream server | ||
+ | < | ||
+ | git fetch | ||
+ | </ | ||
+ | |||
+ | Then you need to update any branches that you want to expose to the downstream repositories. \\ | ||
+ | Examples for master, 13.0 and all remote branches. \\ | ||
+ | Avoid *:* if upstream repo is very big and you want to limit the branches used by downstream repositories. | ||
+ | < | ||
+ | git fetch origin master: | ||
+ | git fetch origin 13.0:13.0 | ||
+ | git fetch origin ' | ||
</ | </ | ||
general/git.1639991499.txt.gz · Last modified: 2021/12/20 09:11 by sunkan