- make sure you are on the correct branch (example:
correctbranch
):
git checkout correctbranch
- make sure you are on the latest version of the branch:
git pull
- add all relevant files (example:
file1
...file3
):
git add file1 file2 file3
or all files (make sure no unneeded files are added):
git add .
- create a commit
git commit -m "message - what did you change?"
push
(upload) the commit toorigin
(usually GitHub):
git push
- (after committing and pushing) go to GitHub and open a pull request (PR) from your work branch to
master
- Change branch to
master
git switch master
- create and switch to a new branch (example:
newbranch
) based on the current branch (should bemaster
)
git switch -c newbranch
Run the following commands in a terminal/command prompt:
git config --global pull.rebase true
git config --global rebase.autoStash true
git config --global pull.ff true
- to successfully
checkout
, there can be no uncommitted modified files -commit
or undo your changes
- make sure you aren't trying to
push
to themaster
branch - it's protected and cannot be pushed to directly - if you are pushing a new branch (example:
newbranch
, it doen't exist inorigin
. Use
git push --set-upstream origin newbranch