User Tools

Site Tools


git

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
git [2023/02/13 11:15] – [Creating a branch (and possibly pushing to upstream origin)] dblumegit [2024/04/11 16:58] (current) – [git at dlma.com] dblume
Line 24: Line 24:
   git@fake.github.com:project/project.git   git@fake.github.com:project/project.git
 </code> </code>
 +
 +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 115: Line 124:
 git switch main git switch main
 git branch -d bugfix/JIRA-1-new-bugfix git branch -d bugfix/JIRA-1-new-bugfix
 +git pull
 +</code>
 +
 +====== Resolving a Merge Conflict ======
 +
 +<code>
 +git mergetool (possibly with filename)  # Bring up the vim 3-way diff
 +
 +# +----------+-----------+------------------+
 +# | (others) | (common)  | (my most recent) |
 +# | LOCAL    | BASE      | REMOTE           |
 +# +-----------------------------------------+
 +# |                                         |
 +# | temp file with <<< ||| >>> diffs        |
 +# +-----------------------------------------+
 +
 +git commit -a -m "Resolved merge conflict"
 +</code>
 +
 +Possibly keep rebasing.
 +<code>
 +git rebase --continue
 git pull git pull
 </code> </code>
Line 141: Line 172:
 <code bash> <code bash>
 git pull --rebase  # --dry-run to test first git pull --rebase  # --dry-run to test first
 +</code>
 +
 +====== Applying changes in a stash to a changed file =====
 +
 +When ''git stash apply'' doesn't work: Show the stash changes and pipe that to patch. Now you have a patch you can apply.
 +
 +<code>
 +git stash show -p | patch -p0
 </code> </code>
  
Line 185: Line 224:
 </code> </code>
  
-could've used gitweb but I used GitHub-like [[https://github.com/klaussilveira/gitlist|gitlist]] at http://git.dlma.com.+Options are: 
 + 
 +  * chose GitHub-like [[https://github.com/klaussilveira/gitlist|gitlist]] for https://git.dlma.com, because it works on my shared server. 
 +  * [[https://www.reddit.com/r/selfhosted/comments/13hxnf4/selfhosted_git_services_you_dont_need_a_huge/|cgit]] might work 
 +  * [[https://gogs.io/|gogs]] 
 +  * [[https://git-scm.com/book/en/v2/Git-on-the-Server-GitWeb|GitWeb]] (the one built-in.
  
 ====== Limit scope of huge repos ====== ====== Limit scope of huge repos ======
git.1676315732.txt.gz · Last modified: 2023/04/12 20:44 (external edit)