First, when you create a branch, do so with git switch: git switch -c test origin/master, preferably after a git fetch (in order for origin/master to reflect the latest commit pushed there)
Then make sure your first push is git push -u origin test in order to establish a remote tracking branch origin/test, which will facilitate the subsequent pushes to that branch.
When you colleague do a git switch test (after a fetch), the default guess mode automatically establish a remote tracking branch (as if they typed git switch -c <branch> --track <remote>/<branch>)
That is why a simple git pull would be enough to update their local test branch after your step 5.
github - Git pull command - Stack Overflow
git - Pull a certain branch from the remote server - Stack Overflow
How to use 'git pull' from the command line? - Stack Overflow
I love showing this graphic to new git users who are confused about the differences between pull, checkout, and fetch
First, when you create a branch, do so with git switch: git switch -c test origin/master, preferably after a git fetch (in order for origin/master to reflect the latest commit pushed there)
Then make sure your first push is git push -u origin test in order to establish a remote tracking branch origin/test, which will facilitate the subsequent pushes to that branch.
When you colleague do a git switch test (after a fetch), the default guess mode automatically establish a remote tracking branch (as if they typed git switch -c <branch> --track <remote>/<branch>)
That is why a simple git pull would be enough to update their local test branch after your step 5.
The only way to do this is, as suggested by @larsks, to issue a git pull.
Instead, if anybody need to inspect changes before pulling them, he can:
git fetch --all
git diff HEAD..origin/<BRANCH-NAME>
But I get an error "! [rejected]" and something about "non fast forward"
That's because Git can't merge the changes from the branches into your current master. Let's say you've checked out branch master, and you want to merge in the remote branch other-branch. When you do this:
$ git pull origin other-branch
Git is basically doing this:
$ git fetch origin other-branch && git merge other-branch
That is, a pull is just a fetch followed by a merge. However, when pull-ing, Git will only merge other-branch if it can perform a fast-forward merge. A fast-forward merge is a merge in which the head of the branch you are trying to merge into is a direct descendent of the head of the branch you want to merge. For example, if you have this history tree, then merging other-branch would result in a fast-forward merge:
O-O-O-O-O-O
^ ^
master other-branch
However, this would not be a fast-forward merge:
v master
O-O-O
\
\-O-O-O-O
^ other-branch
To solve your problem, first fetch the remote branch:
$ git fetch origin other-branch
Then merge it into your current branch (I'll assume that's master), and fix any merge conflicts:
$ git merge origin/other-branch
# Fix merge conflicts, if they occur
# Add merge conflict fixes
$ git commit # And commit the merge!
Simply track your remote branches explicitly and a simple git pull will do just what you want:
git branch -f remote_branch_name origin/remote_branch_name
git checkout remote_branch_name
The latter is a local operation.
Or even more fitting in with the GitHub documentation on forking:
git branch -f new_local_branch_name upstream/remote_branch_name
Try setting the HOME environment variable in Windows to your home folder (c:\users\username).
( you can confirm that this is the problem by doing echo $HOME in git bash and echo %HOME% in cmd - latter might not be available )
Open up your git bash and type
echo $HOME
This shall be the same folder as you get when you open your command window (cmd) and type
echo %USERPROFILE%
And – of course – the .ssh folder shall be present on THAT directory.