Andrea Daly : Create a New Feature Branch from Remote Master via Clone

[make dir and cd into or cd into existing dir]

mkdir <project-dir>

cd <project-dir>

 

[clone repo and cd into newly cloned project dir]

git clone <remote-ssh-url>

[example: git clone git@gitlab.com:andrea-sample-resources/git-lab-examples.git]

ls

cd <cloned-project-dir>

 

[provide name for feature branch]

git checkout -b <new-local-feature-branch>

 

[make and commit changes , push to remote]

git commit -am "ROP-1234 - format for commit messages"

git push -u origin <new-local-feature-branch>

 

[now branch is  tracked, subsequent push to remote is: ]

git push

 

[to create another new feature branch]

git switch master

git checkout -b <another-new-local-feature-branch>

git push -u origin <another-new-local-feature-branch>

 

[verify newly created remote branch and remote tracking branches]

git branch -r

git branch -vv

 

[if subsequently need to work on an exisiting remote feature branch can:]

[view remote branches and select one to track]

git branch -r

git checkout --track origin/<another-existing-remote-branch>

[example: git checkout --track origin/new-feature-b]