Git Commands

Terms

Setting up

Basic Commands

Merging

Git Large File Storage (LFS)

When adding files larger than 100mb, versioning for it will no longer be available, forcing the repository to be completely usable, use git LFS to manage these large files

Advanced Commands

WARNING : Commands below will might result in an unstable repository or overwritten changes when used incorrectly! Use with care!

DANGER LEVEL

  1. No danger (but access advanced data)
  2. overwrites local changes (if no errors)
  3. overwrites local & can affect remote changes
  4. overwrites local & overwrites remote changes (poweruser!)

Cross-GUI Interations

Helpful Windows CMD Commands

Git Configurations

.gitignore

Excludes certain files from being pushed. Can be overriden with git add <> -f https://git-scm.com/docs/gitignore

.gitattributes

Various git config attributes Involves language statistics watcher https://git-scm.com/docs/gitattributes

.gitkeep

Placeholder file for empty directories

Signing commits on github

Setting up (Using GPG)

  1. Install GPG command line tools https://www.gnupg.org/download/ For windows, get Gpg4win
  2. Locate gpg.exe If following default installation path, should be under: C:\Program Files (x86)\GnuPG\bin cd to said directory
  3. gpg.exe --full-generate-key
  4. kind of key: Enter to accept default
  5. key size: Enter to accept default
  6. length of time: Enter to accept default (doesn't expire)
  7. Verify selections above
  8. Enter your user ID information. For a private email address, use github provided no-reply! Your no-reply github email is viewable under github website settings > Emails (https://github.com/settings/emails) It will look something like this ID+USERNAME@users.noreply.github.com or this USERNAME@users.noreply.github.com
  9. Type a secure passphrase
  10. Get list of keys with: gpg.exe --list-secret-keys --keyid-format=long
  11. copy the ID, ID should be under sec right after first \ For example: sec 4096R/3AA5C34371567BD2 2016-03-10 [expires: 2017-03-10] 3AA5C34371567BD2 is the ID
  12. gpg.exe --armor --export <INSERT_ID_HERE>
  13. Copy the GPG key generated
  14. Go to your github website settings > SSH and GPG keys (under Access section) (https://github.com/settings/keys)
  15. Click New GPG key
  16. Confirm and authenticate
  17. git config --global gpg.program "C:\Program Files (x86)\GnuPG\bin\gpg.exe" replace path there to path to your gpg.exe if different
  18. git config --global gpg.program gpg
  19. git config --global user.signingkey <INSERT_ID_HERE>
  20. Profit! Your key is stored and automatically applied as long as you are using the same device with Cpg4win installed.

Removing passphrase

  1. gpg --passwd <INSERT_ID_HERE>
  2. Enter your passphrase as normal
  3. Keep the new passphrase empty and accept the warnings
  4. Repeat step 3
  5. Passphrase is now removed for this device

Revision #14
Created 15 January 2024 07:08:56 by neinwhal
Updated 5 March 2025 05:23:55 by neinwhal