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