Git Feature Branches

Git Feature Branches

Some useful command for me to remember.

When working on a new feature switch back to master do a git pull to get the latest and create a new branch.

git branch my-new-feature

Now switch to the new branch.

git checkout my-new-feature

After working on you feature you can push updates. Before pushing run.

git status

This will display what files you have changed make sure you are not pushing something maybe change by linting etc

git add .
git commit -m 'new update'
git push

It will ask you to set the origin.

If you need to pull down an existing remote branch to work on you can first check the remote branches.

git branch -r

You made need to fetch to get the latest branches

git fetch --all

Now to pull your remote branch and track it locally run.

git checkout --track origin/my-new-feature

Now you can work on your branch update etc.

Leave a comment

Your email address will not be published. Required fields are marked *