[email protected]:name/repo.git
git remote add contributor https://github.com/name/repo.gitgit fetch contributorgit checkout -b update contributor/mastergit push contributor update:master
git remote add upstream https://github.com/whoever/whatever.gitgit fetch upstreamgit pull upstream [target branch]
git checkout <new branch/fork>git reset --soft $(git merge-base $(git rev-parse --abbrev-ref HEAD) [master/main])git commit -m "Squashed commit"
- Create repo on GitHub
git initin proj dirgit remote add origin [ssh_link_for_repo]git remote -v(to confirm)- when ready:
git add .git commit -m “message”git branch -M maingit push -u origin main
git branch -m [new_name](local)git push origin -u [new_name](remote)git push origin :[old_name](old remote)
git diff [branch to compare]
git cherry-pick [commit hash]- if theres a conflict, go into the file and delete the bit trying to override + "=====" + branch headers
git add [changed file(s)]git cherry-pick --continue
git submodule add <link>.gitgit mv <submodule-dir> /new/location/name
git submodule update --remote --merge
git submodule deinit -f --allgit submodule update --initORgit submodule foreach --recursive git reset --hardgit submodule update --recursive
git reset --hard HEAD~n||git reset --hard HEAD^(for back one)git push origin [branch] -f
git reset --hard HEAD@{n}git push origin [branch] -f
git commit --amend --no-editgit push origin [branch] -f
git commit --amendgit push origin [branch] -f
git checkout .
git reset --soft HEAD~1[keeps work]git reset --hard HEAD~1[deletes work]
- n = # of commits to view
git rebase -i HEAD~n- see the descriptions for what can be done
- change the text in front of the sha1 and save to do the actions
- when done, check
git logthat everything worked as intended - if so,
git push origin [branch] -f
git checkout custom-branchgit reset --soft $(git merge-base base-branch HEAD)git commit -m "My commit!"
git checkout --orphan [tmp_branch]git add -Agit commit -am "message"git branch -D [old_branch]git branch -m [old_branch]git push -f origin [old_branch]
git remote update origin --prune
git branch -a | grep -v "keep" | xargs -I{} echo {} | sed -e 's/^ *//' -e 's/remotes\/origin\///' | xargs git push origin --delete