0

So I’m having problems with git since it’s needlessly complicated, literally the only thing I want to do, is, let’s say, switch from master to a newer or older branch and pull the changes to my local machine, that’s it. I’ve tried doing

git checkout <branchname>

git fetch

git pull 

but it doesn’t download any changes from the branch I switched to.

How do I do it properly? I don’t want to upload anything to the actual repository, no commits or merges to master etc., I just need to switch branches for testing purposes, being able to run it locally.

Ling Vu
  • 4,740
  • 5
  • 24
  • 45
  • do you get any output if you run `git diff origin/` ? – mimikrija Feb 19 '20 at 13:17
  • `git fetch :` – 0andriy Feb 19 '20 at 13:25
  • In fact, Git is needfully complicated. *You* don't need all the complications yourself, at least not yet, but many people do. The trick here though, for your case, is: *don't use any branch names. Do not use `git pull` at all.* Use the remote-tracking names, or raw commit hash IDs: run `git checkout` on raw hash IDs, or names like `origin/master`, or tag names. – torek Feb 19 '20 at 19:50

1 Answers1

0
git fetch
git checkout <branchname>

It's important you FIRST fetch and then checkout the branch. If you want to see the available branches:

git branch -r

And this post is actually a duplicate, so try to find the proper article in stackoverflow next time:

How do I check out a remote Git branch?

Mo3bius
  • 642
  • 1
  • 8
  • 18