Clearcase was my first version control software. I used it for 2 years and eventually I liked it since most of the commands are really simple to understand. In these two years I used to debug the code on debugging branch. Once I was done with the fix, I renamed the branch to follow the standard specified by my company. The command below was really handy to rename the branch.
If you have made some changes in a file and now you don't want those changes. you can run the following command to do that.
[cmd-context] $rename replica:old_branch_name new_brach_nameBut when I migrated to Git version control, I couldn't get head around git. It took a while to discover that even git has command to rename the branch which is as following.
$ git branch -m old-branch-name new-branch-nameThis kind of practice leaves a lot of branches in your local and remote repo and sometimes you wonder to clean this up.
$git push origin :debug-branchThe above command will delete debug-branch on the origin remote and below is the command used to delete the branch present in local repo.
$ git branch -D debug-branchThis command can also be used with -d option. The only difference between these two commands is that -D forces the delete process but -d doesn't.
$ git checkout <file-name>There are instances when you staged the file but now you want to unstage the file. For this use the below command.
$ git reset HEAD <file-name> ...
Your valuable comments are always welcomed. It will help to improve my post and understanding.
"By three methods we may learn wisdom: First, by reflection, which is noblest; Second, by imitation, which is easiest; and third by experience, which is the bitterest."
By : Confucius