In order to create new branch, you have to first clone
existing repository to your local machine and then modify/add your cloned
codebase as required. Once you are done with changes, commit changes to
repository with new branch name.
Below are the steps to create new branch
Create New Branch
Clone existing repository:
- Open git bash window
- Move to your work location or where you want to clone your code
- Clone repository to local
- Get inside your repository folder, in my case it is TestRepo
- Checkout branch to be clone, for me it is develop_test
Branch develop_test set up to track remote branch develop_test from origin.
Switch to a new branch develop_test
- Fetch latest from repository
$ git pull origin
Now you are done with cloning.
Its time to push newly created clone to repository to create new branch
- Create New branch
- Push new branch to repository
- Commit file to repository
$ git add .
Step 2 : commit changes to local repository
Step 2 : commit changes to local repository
$ git commit –m “commit message”
Step 3 : push commit changes to remote repository
Step 3 : push commit changes to remote repository
$ git push origin
Delete branch
It is two step procedure, first delete from local and then
push to repository to delete from remote.
- Delete from local file system
- Delete branch from repository
No comments:
Post a Comment