Practical Web Programming

Thursday, March 21, 2013

Git: How to Create a New Branch and Merge it's Changes to Develop Branch

$ git checkout -b new_branch develop

This command will create a branch called new_branch off of develop branch and will switch to it automatically. So now you are in the new_branch branch and can make your changes. When finished, commit the changes and switch to develop branch.

$ git checkout develop

You can now merge by running:

$ git merge new_branch

This command will merge the changes in new_branch to the develop branch.

Wednesday, March 20, 2013

How to Clone a Remote Git Repository

To clone a remote git repository, run the following command in the terminal/console. 

$ git clone

This will create a directory named MyTestProject in the current path, initializes a .git directory inside it, pulls down all the data of that repository, and checks out a working copy of the latest version. If you go into the new git directory, you'll see the project files in there, ready to be worked on.   

If you want change the name of the directory to be created, use the command below.   

$ git clone YourTestProject 

Where YourTestProject is the name of the directory you want when git clones the repository.

This example uses github as the remote repository, but you can use this format with any repo provider like beanstalk.

Recent Post