git

Standard git convention. conventions for commit: Use [title]: [ now explain the title ], where [title] is one of the following. - feat – a new feature is introduced with the changes - fix – a bug fix has occurred - chore – changes that do not relate to a fix or feature and don’t modify src or test files (for example updating dependencies) - refactor – refactored code that neither fixes a bug nor adds a feature - docs – updates to documentation such as a the README or other markdown files - style – changes that do not affect the meaning of the code, likely related to code formatting such as white-space, missing semi-colons, and so on. - test – including new or correcting previous tests - perf – performance improvements - ci – continuous integration related - build – changes that affect the build system or external dependencies - revert – reverts a previous commit * from https://www.freecodecamp.org/news/how-to-write-better-git-commit-messages/

I use ai to follow the standard git convention.

how to resolve divergent branches

https://stackoverflow.com/questions/71768999/how-to-merge-when-you-get-error-hint-you-have-divergent-branches-and-need-to-s git fetch origin will “download objects and refs from another repository” git rebase will “reapply commits on top of another base tip”

fast forward means we make a new commit applying the divergent branches.

rebase means we ignore a certain branch, apply the second branch and then apply the first branch.

how to create a new github repo

git init
git remote add origin [URL]
# git@github.com:kabIndepthnotes/my_scripts.git
git push --set-upstream origin main

how to check what remote repo you are pushing to

git remote -v

how to amend previous commit

stash, rm --cached as appropriate then

git commit --amend

submodules

This is what I use for vim’s built-in plugin functionality.

git submodule update --init --recursive

re-writing history

git reset --soft [commit hash]
git push -f [origin branchname]

credit: https://www.reddit.com/r/git/comments/ghvwq9/how_can_i_completely_delete_commits_from_both/

remove files from git but keep local

git rm --cached [file]

change origin

git remote rm origin

git remote add origin git@github.com:user/repo.git

backlinks