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.

Answer from VonC on Stack Overflow
🌐
Git
git-scm.com › docs › git-pull
Git - git-pull Documentation
You can choose to provide the name of a file in $GIT_DIR/remotes. The URL in this file will be used to access the repository. The refspec in this file will be used as default when you do not provide a refspec on the command line. This file should have the following format: URL: one of the above URL formats Push: <refspec> Pull: <refspec>
🌐
W3Schools
w3schools.com › git › git_pull_from_remote.asp
Git Pull from Remote
With Git, you can do that with pull. pull is a combination of 2 different commands: fetch · merge · Let's take a closer look into how fetch, merge, and pull works. git fetch downloads new data from a remote repository, but does not change your working files or branches.
Discussions

github - Git pull command - Stack Overflow
Please help to clarify the question below. I have done the following steps. git checkout -b test origin/master Made some code changes git add followed by git commit and git push One of my colleagues More on stackoverflow.com
🌐 stackoverflow.com
git - Pull a certain branch from the remote server - Stack Overflow
The {repo} can also be a URL, so ... remote first (stick the fetch/pull command in the new branch description;-) 2022-02-12T16:07:51.097Z+00:00 ... Save this answer. ... Show activity on this post. ... After creating a new "dev" branch on github, and trying the above, I got the ... More on stackoverflow.com
🌐 stackoverflow.com
How to use 'git pull' from the command line? - Stack Overflow
We were using a build script to automate our publishing process and it was working with SVN but now we are using Git and need to do some command line operations to pull from our remote repository. ... More on stackoverflow.com
🌐 stackoverflow.com
I love showing this graphic to new git users who are confused about the differences between pull, checkout, and fetch
I don't think rebase is touching remote More on reddit.com
🌐 r/git
29
29
June 22, 2023
🌐
Atlassian
atlassian.com › git › tutorials › syncing › git pull
How to Pull a Git Repository? | Atlassian Git Tutorial
The git pull command is used to fetch and download content from a remote repository and immediately update the local repository to match that content. Merging remote upstream changes into your local repository is a common task in Git-based ...
🌐
CloudBees
cloudbees.com › blog › git-pull-how-it-works-with-detailed-examples
Git Pull: How It Works With Detailed Examples
July 9, 2021 - In a nutshell, it’s the command you use to update your repository with new changes. To better understand git pull, you need to understand how network operations work in Git.
Find elsewhere
🌐
TheServerSide
theserverside.com › blog › Coffee-Talk-Java-News-Stories-and-Opinions › Git-pull-vs-fetch-Whats-the-difference
Git pull vs fetch: What's the difference?
The key difference between git fetch and pull is that git pull copies changes from a remote repository directly into your working directory, while git fetch does not. The git fetch command only copies changes into your local Git repo.
🌐
Git Tower
git-tower.com › learn › git faq › git fetch vs git pull: what's the difference?
Git Fetch vs Git Pull: What's the Difference? | Learn Version Control with Git
1 week ago - Before we talk about the differences between these two Git commands, let's stress their similarities: both are used by Git users to download new data from a remote repository. Git pull and fetch copy changes from a remote GitHub or GitLab repo locally.
Top answer
1 of 16
1089

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!
2 of 16
413

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
🌐
GitHub
github.com › git-guides › git-pull
Git Guides - git pull · GitHub
git pull is one of the 4 remote operations within Git. Without running git pull, your local repository will never be updated with changes from the remote. git pull should be used every day you interact with a repository with a remote, at the minimum.
🌐
DataCamp
datacamp.com › tutorial › git-push-pull
Git Push and Pull Tutorial | DataCamp
February 27, 2026 - You can now move to step 8, but there is a need for a local repository update with the upstream repository. Alternatively, you can dogit pull-request in the command line and complete the PULL Request to GitHub, where it will force you to push your current branch to a remote repository.
🌐
GitLab
about.gitlab.com › blog › open source › git pull vs. git fetch: what's the difference?
Git pull vs. git fetch: What's the difference?
September 24, 2024 - Git pull is a Git command that performs both git fetch and git merge simultaneously. This article outlines the characteristics and appropriate uses of each.
🌐
Linux Kernel
kernel.org › pub › software › scm › git › docs › git-pull.html
git-pull(1)
December 14, 2025 - The "remote" repository that is the source of a fetch or pull operation. This parameter can be either a URL (see the section GIT URLS below) or the name of a remote (see the section REMOTES below). ... Specifies which refs to fetch and which local refs to update. When no <refspec>s appear on the command ...
🌐
Medium
medium.com › @pinglinh › how-to-use-git-pull-80ad77a8afc6
How to use git pull. How to use git pull function? Let me… | by linhothy | Medium
July 27, 2016 - a. $ git pull origin master · 6. Add your current files in the local folder to the staging area · a. $ git add –-all · 7. Commit your changes · $ git commit -m "your commit message e.g. First commit" 8. Push your changes to the master ...
🌐
Graphite
graphite.com › guides › how-to-use-git-pull
How to use git pull
The git pull command integrates changes from a remote repository into the current branch in your local working directory. The remote repository is the remote location all of your code and its history of changes are stored.
🌐
Git
git-scm.com › docs › git-request-pull
Git - git-request-pull Documentation
Then, you run this command: git request-pull v1.0 https://git.ko.xz/project master · which will produce a request to the upstream, summarizing the changes between the v1.0 release and your master, to pull it from your public repository. If you pushed your change to a branch whose name is different ...
🌐
freeCodeCamp
freecodecamp.org › news › git-pull-explained
Git Pull Explained
January 27, 2020 - git pull is a Git command used to update the local version of a repository from a remote. It is one of the four commands that prompts network interaction by Git. By default, git pull does two things.
🌐
Medium
medium.com › mindorks › what-is-git-commit-push-pull-log-aliases-fetch-config-clone-56bc52a3601c
What is git commit, push, pull, log, aliases, fetch, config & clone | by Amit Prajapati | MindOrks | Medium
November 17, 2019 - The git pull command is actually a combination of two other commands, git fetch followed by git merge. In the first stage of operation, git pull will execute a git fetch scoped to the local branch that HEAD ( means the reference to the current commit) is pointed at.
🌐
Git Tower
git-tower.com › learn › git faq › how to use git pull in git (with examples)
How to Use git pull in Git (with Examples) | Learn Version Control with Git
1 week ago - The git pull command downloads the code that is available from a remote repository (such as GitHub, GitLab, BitBucket, or another code hosting platform) and automatically merges any changes.