Tips and Tricks for git

less than 1 minute read

GitHub is a internet hosting provider for software development and version control using git. It provides distributed version control, source code management, issue tracking and many more. This is now the number one version control provider. Here, I will discuss on tips and tricks of git

  • Discard unstaged changes in Git?
    For all unstaged files in current working directory use:
     git checkout -- .
  • Merge your local uncommited changes
  git stash
  git pull
  git stash apply
  • Remove cached files
    • Go to the directory and run the following command
       git rm -r --cached obj/
  • Move git repository to another repository with history
cd existing_repo

git remote rename origin old-origin

git remote add origin

git push -u origin --all

git push -u origin --tags