C
C#8mo ago
Redoxi

❔ How to sync a git branch on my laptop?

Hey, i made a branch in a repository with my pc, now i need to edit some files but i don't have that branch on my laptop. Is there a way to clone the branch so i can use it on my laptop and be able to sync it on my pc when i want to do further changes later?
15 Replies
Murten
Murten8mo ago
Upload it to GitHub. Then clone the repo on your laptop.
Redoxi
Redoxi8mo ago
I already created a branch for it also have some commits from my pc but when i try "git clone <link to branch repo>" i get this error: fatal repository 'link to branch repo' not found
Murten
Murten8mo ago
Are you sure that you have the correct link?
Redoxi
Redoxi8mo ago
ah just got it, i used this: git clone 'link to repo' --branch usedbranch --single-branch thanks 👍
Murten
Murten8mo ago
Not sure why you wouldn't just clone the repo and checkout the branch you want to use.
Redoxi
Redoxi8mo ago
oh wait, i can just clone the repo and use any branch? didn't know that, will do that instead thanks
Murten
Murten8mo ago
Yeah, you create a local copy of the remote branch, commit your changes to that and then push those to the remote.
Redoxi
Redoxi8mo ago
Okay that sounds easier, thanks 👍
Redoxi
Redoxi8mo ago
Last question, im using vscode so i would on the bottom left chose the main branch that my local repo stays updated and on the commit page i would chose my branch right?
No description
Murten
Murten8mo ago
I'm unfamiliar with git integration in VSC but I assume the bottom left shows what branch you have checked out and then you can commit to that branch.
Redoxi
Redoxi8mo ago
ahh okay, thanks a lot 👍
OkOk
OkOk8mo ago
Instructions unclear; I have a desktop
Murten
Murten8mo ago
Then you'll unfortunately have to manually copy all the files. Technology is not advanced enough yet to support git on desktops.
Accord
Accord8mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.