2023-10-22
Ifølge https://koukia.ca/rename-or-move-files-in-git-e7259bf5a0b7
Hvis du vil være sikker på at file history blir ivaretatt i en fil om du renamer den (eller flytter den), så må du bruke commando-linja og kjøre
git mv mycoolclass.cs myCoolClass.cs
eller
git mv layout/CardList common/List
Hvis du renamer direkte i editor-en, så kan du ikke være sikker på at git skjønner at det er samme fil.
Når du ivaretar git history så kan du bruke ting som git log -p --follow -- path/to/filename. Se gist: https://gist.github.com/paalss/7127b421ff7f3a862ae8d76c772aeb6a
Kommentarer:
Mulig det er unødvendig å bruke mv. Da jeg renamet og flyttet layout/CardList til common/List så skjønte git at disse to filene var 74% like.
git log -p --follow components/common/List/List.tsx funker fjell. Historikken strekker seg tilbake til før renamingen
  
  
2023-10-29
Færre antall branches i code completion suggestion når du skriver git checkout feat-[Tab].
Slett alle branches som ikke finnes på remote:
git fetch -p
(git fetch prune)
Også, sørg for å slette unødvendige tags
List tags
git tag
git tag -d tagName
  
  
2023-11-05
Eg. Search for "use-query-params" in package.json's git history
git grep use-query-params $(git rev-list --all -- package.json) -- package.json
  
  
2024-05-20
git reflog
copy hash (ex: 56e2f8f)
git checkout main/develop
git merge 56e2f8f
  
  
2024-10-21
git ls-files -u | sed -n 's,3\t,0\t,p' | git update-index --index-info
git checkout-index -af
https://stackoverflow.com/questions/73388057/in-git-after-merging-some-files-i-want-to-accept-all-theirs-that-are-left-in?rq=3
  
  
2025-05-12
https://jvns.ca/blog/2023/11/06/rebasing-what-can-go-wrong-/
  
  
2025-08-11
git checkout <commit-hash>
git log 
git diff <previous-commit-hash> > diff.patch
git checkout <main-or-up-to-date-branch>
git apply diff.patch --reverse
  
  
2025-10-16
<!--
git rebase -X theirs main
git rebase -X theirs develop -i
-->
git tag branch_before_rebase
git rebase -X theirs develop
- Manually compare current branch with branch_before_rebase
- Correct whatever needs to be corrected