Starting a new Git repository for an existing code base

$ cd MyProject
$ git init
$ git add . //Add all existing files to the index.
$ git commit -m "Initial commit" //Record the pristine state as the first commit in the history.
$ git remote add origin
$ git push -u origin master

Show the working tree status

$ git status

List, create, or delete branches

$ git branch //List all branches
$ git branch payment master //Create a new branch "payment" based on master
$ git checkout payment //Switch to the "payment" branch
$ git branch -d payment //Delete "payment" branch

Merge branches

$ git checkout master //Switch back to master branch
$ git merge payment //Merge payment branch to the master
$ git push

Categories: Development