Home Navigation

Wednesday 31 October 2018

How to clear local working directory (untracked) all manually added files

To reset a specific file to the last-committed state (to discard uncommitted changes in a specific file):
git checkout thefiletoreset.txt
To reset the entire repository to the last committed state:
git reset --hard

will remove untracked files

git clean -d -x -f 
-d directories
-x files ignored by git
-n for dry-run
-i interactive mode
-f force
-X Remove only files ignored by Git. This may be useful to rebuild everything from scratch, but keep manually created files.

Tuesday 23 October 2018

Checking used port/application in windows command

Checking which application is using a port:

  • Open the command prompt
  • Type netstat -aon | findstr [port_number]
  • If the port is being used by any application, then that application’s detail will be shown. The last column of the list, is the PID of that application. Take a note of the PID.
  • Type tasklist | findstr [PID]
  • You’ll be shown the application name that is using your port number.


Checking which port is being used by a application:

Exactly the reverse of the above steps.

  • Open the command prompt
  • Type tasklist | findstr [application_name]
  • Make note of the PID (second column) from the details shown.
  • Type netstat -aon | findstr '[PID]'
  • You’ll be shown the application detail and the corresponding port to which it is listening.