Visual Studio Code: .git folder/file hidden

By default Visual Studio Code excludes files in a folder using the following settings: “files.exclude”: { “**/.git”: true, “**/.svn”: true, “**/.hg”: true, “**/.DS_Store”: true } You can change your user settings or workspace settings to show the .git folder by adding these lines: “files.exclude”: { “**/.git”: false }

Use git “log” from another folder

From, man git: You can do this with the –git-dir parameter, before passing any commands. git –git-dir /foo/bar/.git log (Specifying the .git directory is necessary.) From the documentation: –git-dir=<path> Set the path to the repository. This can also be controlled by setting the GIT_DIR environment variable. It can be an absolute path or relative path … Read more

Listing and deleting Git commits that are under no branch (dangling?)

To remove all dangling commits (including those still reachable from stashes and other reflogs) do this: git reflog expire –expire-unreachable=now –all git gc –prune=now But be certain that this is what you want. I recommend you read the man pages but here is the gist: git gc removes unreachable objects (commits, trees, blobs (files)). An … Read more

git rebase fatal: Needed a single revision

You need to provide the name of a branch (or other commit identifier), not the name of a remote to git rebase. E.g.: git rebase origin/master not: git rebase origin Note, although origin should resolve to the the ref origin/HEAD when used as an argument where a commit reference is required, it seems that not … Read more

Installing Latest version of git in ubuntu

The Ubuntu git maintainers team has a PPA just for that ppa:git-core/ppa Just do: sudo add-apt-repository ppa:git-core/ppa sudo apt-get update sudo apt-get install git Error: Unable to locate package add-apt-repository If add-apt-repository command is not found, install it first with: sudo apt-get install software-properties-common Error: failed to start the dirmngr If you receive the error: … Read more

Using .gitignore to ignore everything but specific directories

Here’s how I did it – you essentially have to walk up the paths, you can’t wildcard more than one level in any direction: # Ignore everything: * # Except for the themes directories: !wordpress/ !wordpress/*/ !wordpress/*/wp-content/ !wordpress/*/wp-content/themes/ !wordpress/*/wp-content/themes/* !wordpress/*/wp-content/themes/*/* !wordpress/*/wp-content/themes/*/*/* !wordpress/*/wp-content/themes/*/*/*/* !wordpress/*/wp-content/themes/*/*/*/*/* Notice how you have to explicitly allow content for each level you … Read more