Git Gud

Git Gud

Unfortunately command line commands take a pretty significant amount of repetition and regular usage to sink in. I mean, I somehow managed to forget mkdir creates a folder, so… probably better to note down the really important ones here rather than have to dig up an old Stack Overflow post every time :v


Core

Remember git clone creates a new folder for the cloned repo, so we don’t need to create it ourselves beforehand.


Messing with History

If we’ve pushed to remote, then we’re screwed. If not, then…

Undo the last commit, but keep the changes locally

git reset --soft HEAD^

Undo the last commit, but erase the changes too

git reset --hard HEAD^

Retrace to a particular commit id

git reset 1f1e33

Tackling the Submodules

Given a project superior and a subproject interior which will be a submodule within the project…

Add, but then you gotta clone too

git submodule add https://github.com/Sup2point0/interior
git submodule update --init

We’re not on a branch!

cd interior
git checkout main

Update

git submodule update --remote

Delete, and delete properly

git rm interior
Indexed
dev A Primer to Programming in Desmos / Coding Conventions / Python / Ruby / What’s up with my Python syntax? / Slithering Hump-Back Kebabs / Buttons: More Complicated Than They Look / decoded / 42 Methods of Flawless Fail-Safe Fixing / Gems in the Abstruse Internet / Git Gud / Migrating Windows Laptops / Especially Ingenious Quotes on Software Development / A Library to Void Future Suffering / The Programmer’s Plight / Roots
lists Favourites / Yu-Gi-Oh! / Python / Ruby / 42 Methods of Flawless Fail-Safe Fixing / Gems in the Abstruse Internet / Git Gud / Especially Ingenious Quotes on Software Development / Features I’d Love in PowerPoint / Fonts / Features I’d Love in Markdown / Quotes / Interests Index / Personal Quotes / Slinqui

LAST DEPLOYED 10 December 2024

VIEW ON GITHUB