Git : Delete remote tag

April 18th, 2014 § 0 comments § permalink

Here is how you can delete a git tag in the local and remote repo. It is pretty similar how we delete remote branch.

To delete tag locally use

git tag -d v1.0.0

To delete tag in the remote repo

git push origin :refs/tags/v1.0.0

Thats it.
Thank you.

Git : delete remote branch

January 26th, 2013 § 0 comments § permalink

Delete local branch

Deleting a local git branch is easy, using options `-d` or `-D` will do it. Its is always safe to use `-d` option because it won’t allow us to delete unmerged branch, where as `-D` will delete the unmerged branch without any warning or notification.

git branch -d branch_name_to_delete

But this will delete only branch in our local system.

Delete remote branch

So how can we delete a remote branch? Any way none of the option for git branch won’t delete it. Remote branch can only deleted by using git push command.

 git push origin :branch_name_to_delete

You have to notice the full-colon (:) prefixed to the branch name. The prefixed colon is the one asking git to do the trick.

Thanks.

Git : copy all changed files between two commits with directory structure

April 13th, 2012 § 4 comments § permalink

While working on a project, I was unable to configure git on the shared host. It was a nightmare to upload only the changed files after a bug fix. Keeping track manually on all the changed files got failed. So I started searching for a easy solution and I end up with a script which I can copy the changed files between two commits with directory structure.

In this I only need to keep track of the last uploaded commit, which seems to be easy for me. You just need to save the below script to git-copy.sh file and keep in the root folder of the project. Don’t forget to give execute permission for the file.

How to Use

This script accepts three parameters.

  • The Hash of First commit
  • The Hash of second commit
  • The destination folder, where we need to copy the files.

Syntax to execute :

./git-copy.sh hash1 hash2 path/to/destination/folder

Example :

Add colour to your git output in terminal

August 3rd, 2011 § 0 comments § permalink

Have you ever thought that it should be good if the git output in your terminal is colourful? ie.,

  • Added files in one colour
  • untracked files in some other colour
  • Added lines and deleted line is differentiated with colour

Here is the simplest way you can achieve it. Just run the following command after changing the directory into project directory/git repository
  This will show the git output in colour, only for this specific git repository. If you need the same for all git repository then you should run
Now check your git output. It will be colourful and  you will find really easy to differentiate the added and untracked files. Try git diff, you will find even more easier to find the added and deleted line.

Happy Coding.