1. Create a new branch for your work.
2. Switch to the new branch.
3. Make changes and commit them.
4. Check your work (status and log).
5. Push the branch to the remote repository.
-
Create and switch to a new branch:
git checkout -b your-branch-name
Replace your-branch-name with a descriptive name for the branch. -
Check your branch (optional):
git branch
Confirms you’re on the correct branch. -
Check your current status (to see unstaged changes):
git status
-
Stage and commit your changes:
git add . # Stages all changes in the current directory
git commit -m "Your commit message"
- Replace "Your commit message" with a concise description of what you changed.
-
Check your commit history:
git log --oneline
Shows a condensed history of your commits. -
Push your branch to the remote repository:
git push origin your-branch-name
-
Verify the push was successful (optional): Check your branch in the remote repository or confirm with teammates.