Skip to content

Instantly share code, notes, and snippets.

View baleeds's full-sized avatar

Benjamin Leeds baleeds

View GitHub Profile
@tsrivishnu
tsrivishnu / gitignore_already_tracked_file.md
Last active August 12, 2024 11:30
Git: Ignore already checked in file

Git: How can I ignore a file that is already committed to the repo?

You have a repo and quite some developers have cloned the repo and working on it. Now you want to add a file to gitignore which is already checked-in or tracked by Git.(The file is already commited into the repo)

Below are the steps on how to ignore this file (lets say the filename is config.py):

  • Add it to .gitignore:

$ echo "config.py" >> .gitignore

@jordan-brough
jordan-brough / git-recent
Last active September 11, 2024 21:46
Git: Display a list of recently checked out branches/tags/commits
#!/usr/bin/env bash
# Source: https://gist.github.com/jordan-brough/48e2803c0ffa6dc2e0bd
# See also: https://stackoverflow.com/a/25095062/58876
# Download this script as "git-recent" (no extension), chmod it to be executable and put it in your
# path somewhere (e.g. /usr/bin). You can then use it via `git recent` from inside any git repo.
# Examples: