Skip to content

Instantly share code, notes, and snippets.

@jamesstidard
Last active January 26, 2021 10:18
Show Gist options
  • Save jamesstidard/e017c32b2b1b101d86cfe257c3be42a6 to your computer and use it in GitHub Desktop.
Save jamesstidard/e017c32b2b1b101d86cfe257c3be42a6 to your computer and use it in GitHub Desktop.
A list of terminal commands I always forget because I infrequently need them

Forgotten Commands

git

Remove accidently tracked files/folders from git and keep local.

$ git rm --cached -r <somedir/file/regex>

Undo previous unpushed commits, keeping the changes, for better commit message.

$ git reset --soft HEAD~<number-of-commits-to-undo>

Change last commit message.

$ git commit --amend -m "new commit message"

Append to last commit on update commit message.

$ git add new_file.ext
$ git commit --amend -m "new commit message"

Update branches to show newly created branches by others.

$ git remote update origin --prune

pipenv

Installing from github repo with ssh

# version
# - commit: "{commit-id}"
# - branch: "{branch-name}"
# - release: "v{version-number}"
$ pipenv install -e git+ssh://[email protected]/{username}/{repo-name}.git@{version}#egg={package-name}

upgrading one dependancy without the others:

  1. Figure out the version you want to install, in my case the latests requests, 25.2.1
  2. pipenv install --keep-outdated 'requests==25.2.1' will just update to that version
  3. verify Pipfile.lock shows new version, then git checkout -- Pipfile to revert to what you had before, in my case requests = "*"
  4. verify correct version is installed: $ pipenv graph | ack requests # or grep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment