How to get files from a remote Branch to your local Branch [Github]

572 Views Asked by At

After i commited certain files/changes to a remote branch through the Github Desktop App, i would like to get those changes to the local branch. I do work with SAP Web IDE.

What i tried:

fetch 

Issue: Didn't really work out

Question: How to get the data of the remote Branch to a local Branch ?

2

There are 2 best solutions below

0
On BEST ANSWER

Use git fetch to update your local references to the remote branch. In other words: git fetch checks for updates on the remote repository, but does not yet merge any updates to your local repository. After fetching, use git merge or git rebase to integrate the remote changes into your local repo.

https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes

0
On

There are several ways to retrieve data from remote branch to your local branch.

  1. The simplest one is pull. Just run the following command.

    $ git pull
    
  2. Another way to do it is to merge. But before you have to fetch.

    $ git fetch
    $ git merge
    
  3. You can also use rebase. It also requires fetch.

    $ git fetch
    $ git rebase
    
  4. Another interesting way is to fetch your remote branch and reset your local branch to the remote branch. Lets just say, your local branch is sample. Then just run the followings.

    $ git fetch
    $ git reset --hard origin/sample