Skip to content

Instantly share code, notes, and snippets.

@Pinjasaur
Last active October 18, 2019 20:00
Show Gist options
  • Save Pinjasaur/bbff17817419d745ddb909d24bb585b2 to your computer and use it in GitHub Desktop.
Save Pinjasaur/bbff17817419d745ddb909d24bb585b2 to your computer and use it in GitHub Desktop.
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment