Git Branch Creation and Push Guide
Prerequisites​
- Git installed
- Repository already cloned
- Remote repository access
Steps​
1. Create New Branch​
-
Ensure you're in the correct repository:
pwd
-
Check current branch and status:
git status
git branch -
Create and switch to new branch:
git checkout -b <YOUR-BRANCH-NAME>
-
Verify branch creation:
git branch
# Should show * nati
2. Stage and Commit​
-
Check files to be committed:
git status
-
Stage all changes:
git add .
-
Commit changes:
git commit -m "Initial commit for nati branch"
-
Verify commit:
git log --oneline -n 1
3. Push to Remote​
-
Push new branch to remote:
git push -u origin nati
-
Verify remote push:
git branch -a
Verification​
-
Check branch status:
git status
-
Confirm remote branch exists:
git fetch --all
git branch -r
Troubleshooting​
If push fails:
-
Check remote connection:
git remote -v
-
Ensure you have correct permissions
-
Try forcing push if necessary:
git push -f origin nati
Remember to follow your team's branching conventions and ensure you have the necessary permissions for pushing to the remote repository.