To push a new local branch to a remote Git repository and track it, you can follow these steps:

  • Create a new branch in your local repository by running the following command,Replace <branch-name> with the name of the branch you want to create.
git checkout -b <branch-name> 
  • Make some changes to your code and commit them by running the following command.Replace “Commit message” with a message describing your changes.
git commit -m "Commit message" 

Push the branch to the remote repository by running the following command.Replace <branch-name> with the name of the branch you created in step 1.The -u option tells Git to set up the tracking information for the branch, so you can use git push and git pull without specifying the branch name.

git push -u origin <branch-name> 

Verify that the branch was pushed successfully by running the following command.This will list all the branches in your local repository, including the newly created one. The remote branch will have a name like origin/<branch-name>.

git branch -a

Now you have successfully pushed a new local branch to a remote Git repository and tracked it. You can continue to make changes to your local branch, commit them, and push them to the remote branch using git push.