Pinjasaur
9/30/2017 - 2:16 AM

Git

Gotta git gud, ya know?

Git

Change a remote

Base recipe:

  • git remote set-url <remote> <url>

HTTPS to SSH (GitHub):

  • git remote set-url <remote> git@github.com/<username>/<repository>.git

SSH to HTTPS (GitHub):

  • git remote set-url <remote> https://github.com/<username>/<repository>.git

Apply .gitignore changes

First commit any code changes, then run: git rm -r --cached . and then re-add: git add ..

To undo: git rm --cached filename then git add filename

Convert EOL to LF

  1. Clean working directory.
  2. Set end_of_line = lf in .editorconfig.
  3. Create .gitattributes file containing * text=auto eol=lf.
  4. Commit.
  5. Run git add --renormalize .
  6. Commit.

Sources: https://stackoverflow.com/a/42135910, https://git-scm.com/docs/gitattributes#_effects