DEV Community

silvanet
silvanet

Posted on

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

I like trying out many lesson projects. Often they involve cloning github repos. I know the repos aren't mine and I often add a lot of my own commentaries for my personal learning purposes.

I use vscode as my editor. Vscode tracks my changes and asks me to commit them but I really don't want to do that at all.

I'd rather keep my personal learning notes and comments private at this point. It's not that I don't want to share them. It's more that as a newbie I'd be embarrassed to so so. Maybe later on.

I normally don't fork the repos. I download them into my personal local projects folders. After a bunch of not committed changes, vscode gives me a message something like I have too many uncommitted changes.

Can anyone give me some advice on how to do all my local learning commentaries and notes without publishing them in github or becoming a nuisance with ridiculous pull requests, and stop vscode from telling me I have too many uncommitted changes?

Top comments (4)

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
 
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.

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.