0

I work from home, and from office( in two different computers ). For instance, when i work from home in "someBranch", and next go to office and try to get this "someBranch", i cant see it. Both computers work with two different ssh keys that connected to gitlab.

git fetch origin somebranch:somebranch or git fetch origin -a

dont help. I think that i can just copy ssh key from one computer to another, and maybe it'll help. But idk. It looks weird

Aleksandr
  • 43
  • 1
  • 5
  • 1
    Except when you use `git fetch` or `git push` (or `git ls-remote` and one special case of `git remote show`), Git works *off line*. If you've been doing work from home and haven't sent it to another computer you can reach from work, you can't get to it unless you can reach your home computer directly from work. – torek Jul 01 '22 at 09:06
  • 1
    The usual process most people use here is to do some work from home, then `git push` the new commits to GitLab before heading in to work. Then at work they can `git fetch` the new commits *from* GitLab, keep working, `git push` new commits to GitLab, go home, `git fetch` the new commits, etc. That is, GitLab acts as a third-party depot. – torek Jul 01 '22 at 09:08
  • If your home computers can reach your work ones directly, and vice versa, you can dispense with the third-party, but you will still need to fetch and/or push between the home and work computers. – torek Jul 01 '22 at 09:09

2 Answers2

0

Have you checked what's recommended here:

How do I check out a remote Git branch?

(After fetching the remote repo, you need to checkout a local branch based off of origin/someBranch, to stick to your example.)

picchiolu
  • 1,120
  • 5
  • 20
0

I just understood that is all works well. And I was doing everything properly, except one thing: Gitlab has a property that asks you when you merge in "master": "Do you want to delete source branch ?"

And this box was checked by default.

vvvvv
  • 25,404
  • 19
  • 49
  • 81
Aleksandr
  • 43
  • 1
  • 5