Skip to main content

Posts

Showing posts from September, 2019

How to hard reset a GitHub commit

Get commit ID using this command git log Revert using the specif id git revert 497011c4a1914839a6555dc8041ac8 9b5d1f3241 Reset master branch to the parent of reverted commit id git push origin + 497011c4a1914839a6555dc8041ac8 9b5d1f3241^:master            (git interprets x^ as the parent of x and + as a forced non-fast forward push.)

How to run Django Server forever

Create a shell script with below content and save it as ‘runserver.sh’. while true; do   echo "Re-starting Django Server"   python3 manage.py runserver 0.0.0.0:8000   sleep 2 done Start Django Server using the 'runserver.sh' script If the file was created/edited in Windows environment, you might need to fix the line ending before it can be executed in Linux PC. This can be done by executing below command – sed -i 's/\r$//' runserver.sh Make the shell script executable chmod +x runserver.sh Execute shell script.      ./runserver.sh          Now the server will keep running. To stop the server, press ‘ Ctrl+C’ twice.