Finding Everything That Has Changed in a Git Branch

The following is shamelessly stolen from this StackOverflow post. Go there for more information, as well as some alternatives.

To get the list of files modified (and committed!) in the current branch you can use the shortest console command using standard git:

git diff --name-only master...

  • If your local “master” branch is outdated (behind the remote), add a remote name (assuming it is “origin”):
    • git diff --name-only origin/master...
  • If you want to include uncommitted changes as well, remove the ...:
    • git diff --name-only master
  • If you use different main branch name (eg: “main”), substitute it:
    • git diff --name-only main...
  • If your want to output to stdout (so its copyable):
    • git diff --name-only master... | cat
  • If your want filenames to be clickable in VSCode terminal no matter what folder you are running this command from, add --relative:
    • git diff --name-only --relative master... | cat

Finding Port Numbers In Use on Windows

If you need to determine what process is using a specific port on Windows, you can use the following command:

netstat –ao | findstr <your port number>

If the netstat command returns no results, it may be because the port is excluded from use (perhaps because it has been reserved by some other application or process).  Use the following command to examine the excluded port ranges:

netsh interface ipv4 show excludedportrange protocol=tcp

Deleting a Remote Git Branch

Since I have to look this up *every* *single* *time*, I’ll just leave this post here for my own benefit (and hopefully others’).

Here are the git commands that one would use to delete both local and remote branches:

$ git push --delete <remote_name> <branch_name>
$ git branch -d <branch_name>

Additional detailed information about this can be found at the Stack Overflow post that I have found myself looking up over and over.