C
C#14mo 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
Murten14mo ago
Upload it to GitHub. Then clone the repo on your laptop.
Redoxi
RedoxiOP14mo 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
Murten14mo ago
Are you sure that you have the correct link?
Redoxi
RedoxiOP14mo ago
ah just got it, i used this: git clone 'link to repo' --branch usedbranch --single-branch thanks 👍
Murten
Murten14mo ago
Not sure why you wouldn't just clone the repo and checkout the branch you want to use.
Redoxi
RedoxiOP14mo ago
oh wait, i can just clone the repo and use any branch? didn't know that, will do that instead thanks
Murten
Murten14mo ago
Yeah, you create a local copy of the remote branch, commit your changes to that and then push those to the remote.
Redoxi
RedoxiOP14mo ago
Okay that sounds easier, thanks 👍
Redoxi
RedoxiOP14mo 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
Murten14mo 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
RedoxiOP14mo ago
ahh okay, thanks a lot 👍
OkOk
OkOk14mo ago
Instructions unclear; I have a desktop
Murten
Murten14mo ago
Then you'll unfortunately have to manually copy all the files. Technology is not advanced enough yet to support git on desktops.
Accord
Accord14mo 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.
Want results from more Discord servers?
Add your server