I want to create test branch for testing purpose which is hosted in local repository server, before eventually pushing to master branch in remote repository server. What are the correct steps required?
I want to create test branch for testing purpose which is hosted in local repository server, before eventually pushing to master branch in remote repository server. What are the correct steps required?
Suppose you have remote repository https://github.com/user/repository.git
with master
branch. To create a new local branch, you have to follow the steps below:
Create a new directory and initialize git repository.
mkdir repo
cd repo
git init
Add remote repository.
git remote add origin https://github.com/user/repository.git
Pull files from remote repository.
git pull origin master
Create a new branch.
git branch test
Switch to new branch.
git checkout test
Start modifying your new branch, do some commits, etc.
To push to your remote repository, just run:
git push -u origin test