git
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
git [2023/05/08 18:01] – [Fixing a bug in its own branch] dblume | git [2025/07/08 16:13] (current) – [Building Git] dblume | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== git ====== | ====== git ====== | ||
+ | |||
+ | ===== Building Git ===== | ||
+ | |||
+ | In Ubuntu, get some dev libs first: | ||
+ | |||
+ | <code bash> | ||
+ | sudo apt-get install libssl-dev libcurl4-gnutls-dev gettext | ||
+ | </ | ||
+ | There was [[https:// | ||
+ | <code bash> | ||
+ | git clone --filter=blob: | ||
+ | # or: git clone --branch v2.50.1 --depth 1 https:// | ||
+ | # or even: wget https:// | ||
+ | |||
+ | make prefix=$HOME/ | ||
+ | make prefix=$HOME/ | ||
+ | </ | ||
+ | |||
+ | This will put git in '' | ||
+ | |||
+ | ===== Using Git ===== | ||
Make the clone of the remote repository. | Make the clone of the remote repository. | ||
Line 24: | Line 45: | ||
git@fake.github.com: | git@fake.github.com: | ||
</ | </ | ||
+ | |||
+ | Eventually, if you want to add another branch to a single-branch clone: | ||
+ | |||
+ | git remote set-branches --add origin another-branch | ||
+ | |||
+ | Or to de-single-branch-ize a clone: | ||
+ | |||
+ | git remote set-branches origin " | ||
+ | |||
===== Creating a new remote repository from an existing local one ===== | ===== Creating a new remote repository from an existing local one ===== | ||
Line 121: | Line 151: | ||
< | < | ||
- | git mergetool | + | git mergetool |
- | # +----------+-----------+--------------+ | + | # +----------+-----------+------------------+ |
- | # | | (common) | + | # | (others) |
- | # | LOCAL | BASE | REMOTE | + | # | LOCAL | BASE | REMOTE |
- | # +-------------------------------------+ | + | # +-----------------------------------------+ |
- | # | | + | # | |
- | # | temp files with <<< | + | # | temp file with <<< |
- | # +-------------------------------------+ | + | # +-----------------------------------------+ |
- | # | + | |
+ | git commit -a -m " | ||
+ | </ | ||
+ | |||
+ | Possibly keep rebasing. | ||
< | < | ||
+ | git rebase --continue | ||
+ | git pull | ||
+ | </ | ||
====== Alternative to Rebasing: Stash, Pull, Unstash ====== | ====== Alternative to Rebasing: Stash, Pull, Unstash ====== | ||
Line 195: | Line 231: | ||
git$ cd testcode.git/ | git$ cd testcode.git/ | ||
testcode.git$ git init --bare | testcode.git$ git init --bare | ||
+ | testcode.git$ git config pack.threads 8 # Otherwise clone might fail with " | ||
</ | </ | ||
Line 209: | Line 246: | ||
</ | </ | ||
- | I could' | + | Options are: |
+ | |||
+ | * I chose GitHub-like [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
====== Limit scope of huge repos ====== | ====== Limit scope of huge repos ====== | ||
Line 229: | Line 272: | ||
The submodule one is an optimization for the more general: | The submodule one is an optimization for the more general: | ||
+ | <code bash> | ||
+ | git submodule update --recursive | ||
+ | </ | ||
+ | |||
+ | ====== Submodules ====== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | Cloning a repo doesn' | ||
+ | |||
+ | <code bash> | ||
+ | git submodule update --init --recursive | ||
+ | </ | ||
+ | |||
+ | Git pull and checkout don't update submodules. To actually update them, you have to run the following every time you switch branches or pull. | ||
+ | |||
<code bash> | <code bash> | ||
git submodule update --recursive | git submodule update --recursive |
git.1683594104.txt.gz · Last modified: 2023/05/08 18:01 by dblume