I always keep googling for few of the git commands that I use on a small interval ( not very frequent ) and end up spending more time then I should be. So instead I’ve compiled a list of Git commands that are helpful in my project development, which might be useful for you as well. I’ll keep updating the list as and when I find something useful.
Clone a git repo ( or Checkout in terms of SVN ):
If it’s a private repo, you need to have your SSH keys added on server ( Github, Bitbucket or GitLab ) or you can use the https url to clone with your login details, for a public repo you need not to have SSH keys or login details, after that you can easily clone a git repo.
Navigate to a folder under which you want to clone the repo, and run the command.
Using SSH (If public keys have been added to server)
git clone [email protected]:UmeshSingla/user-tags.git
Using https
git clone https://github.com/UmeshSingla/user-tags.git
Deleting a remote Git Branch:
git push origin –delete branchName
Delete a remote Tag:
git push origin :tagname
After deleting tag remotely, you need to delete the tag locally as well, otherwise you won’t be able to the re-create the tag
Delete a Tag Locally:
git tag -d tagname
Delete a Folder from git repo:
This will delete the folder only from git repo:
git rm -r --cached folderName
In order to Delete the folder from filesystem and git repo:
git rm -r folderName
If you are getting any warnings you can use ‘f’ for force delete:
git rm -rf folderName