Monday, October 21, 2013

Common git commands:


1. To cut a new branch from an existing one
       • git checkout -b "branch name"

2. To push the above created branch
       • git push –u origin “branch name”

3. To rename a branch 
       • git branch –m “old name” “new name”

4. To remove all the commits 
       • git reset –hard origin/branchName

5. To delete a branch (First remove remote)
       • git push origin :branchName

6. To delete a branch (Then Locally)
       • git branch –d branchName
       • git branch –D branchName (Forcefully)

7. To remove a file from staging area
       • git reset HEAD fileName

8. To remove commit 
  • git reset --hard HEAD
then
  • git push origin HEAD --force 

Monday, October 14, 2013

Replacing with new line in eclipse using regular expression:


Regular expression for the new line in eclipse:

For eg:

Convert from :

public String getAddress() {
              return address;
       }

To:

public String getAddress ()
{
return address;
}

Check the regular expression checkbox.

In Find:           \) \{

Replace with:           )\n\t\{
                                 OR
                              )\R\t\{