DEV Community

Discussion on: How do I NOT to commit changes to other people's github repos I clone for learning?

Collapse
 
andrewblyth90 profile image
Andy Blyth

As far as I am aware, when you clone a repo it is not connected to the remote repo. So if VSCode is asking you to commit, it will be to your local repo. Hope that makes sense.

Collapse
 
silvanet profile image
silvanet

Thanks, I've been so confused about that but once you mentioned it I was able to make a search that found a clear (to me) explanation of forking and cloning in the Github community forum, here. github.community/t5/Support-Protip.... I really appreciate your response. I really have to get much better informed about Github. A friend recently told me you can even use it to keep track of revisions on documents you're writing. I do a lot of writing, so that could be useful to me.

Collapse
 
torqu3wr3nch profile image
TorqueWrench

This is correct.

The diff you see in VS Code's source control (git) is a comparison of changes within your local repo, as such there is no harm in committing them:

VS Code Source Control

They won't push to the remote repository (i.e. upload to Github) unless you explicitly tell VS Code to do so, by either clicking on "Push", "Push To", or the little upload cloud on the bottom that indicates "Publish changes". (By the way, push requests are distinct from pull).

Since it sounds like at some point you may want to publish your notes, if I may make one other recommendation, after you clone a repo locally, create a new branch and make your changes there. This will make publishing your changes easier in the future. To create and checkout a new branch, you can use the following command after cloning: git checkout -b

The above command both creates the new branch and checks it out, meaning it switches your working directory to it. If, in the future you need to go back to that branch and it already exists, you can simply use git checkout .

I encourage you to fork though, that way everything isn't just sitting on your local computer.

Hope this helps!

Collapse
 
silvanet profile image
silvanet

This answer was a great help to me. I'm now in the middle of a 5 month BootCamp. At the start, it covered git extensively. I was never sure if I was close to stepping across a line to disaster. Now more than ever I appreciate this simple clarity. I also became confused because of the many ways to manage repos: through the command line, GitHub Desktop, Github itself, vscode, Gitlens. I think the best way is to stick to one. I'm trying to do it from vscode, but often find I have to go the the command line as a last resort. Thanks again, only a couple of years later.