1. Ignore file/folder while commit

    For a File For a folder

  2. Use these commands to delete your last (only one) commit

    From the repo but keep in mind that if other contributors have pulled the code before you start reverting then it may cause problems.

         git reset --hard HEAD~1
         git push --force
    

    If you want to go back by more than one commit we can use

         git reset --hard HEAD~2
         git reset --hard HEAD~3
         git reset --hard HEAD~4
    
  3. To print the last n logs/details of git

         git log -n
    

    Examples

  4. Delete a branch remotely

  5. Push to a remote branch different from master

  6. Change git username while pushing in git credentials