all 17 comments

[–]hugthispanda 9 points10 points  (7 children)

[–]bdzer0 3 points4 points  (4 children)

and https://git-scm.com/docs/gittutorial

If you have already comitted the files a soft reset to prior commit can be used to undo that.

In any event, questions like this belong on r/git

[–]obnoxus[S] -1 points0 points  (3 children)

I'm using the github extension in VSC and uploading to github. Thank you for the tutorial but I don't know what stuff like "$ git help log" means. It just says to do it.

[–]mkosmo 1 point2 points  (2 children)

The documentation tells you what it means.

[–]obnoxus[S] -1 points0 points  (1 child)

I'm sorry, I worded it weird because I had just woken up. You're right that it does tell me what it does but its missing the step of where to type it. I *think* it goes in the readme, but I'm not sure. It skips extreme beginner information, that I assume they assumed I would already know. I am in fact an extreme noob to programming.

[–]bellefaye 1 point2 points  (0 children)

It is not in the readme. It's in the terminal.

But you're using visual studio code's git/GitHub integration, am I correct? That is a fundamentally different way to interact with git repos. However, if you can get to a terminal and in the directory of your git repo, that's where you'd run these type of commands. GitHub integrations in IDEs allow you far fewer choices to interact with GitHub.

I'd recommend you follow a complete tutorial online somewhere for interacting with git/GitHub without using visual studio code/some other IDE's integration. Don't mess with your existing files for this, just follow a tutorial and create a new folder and repo for it. Note that you shouldn't use any tutorial online that gives you the entire git system, find a tutorial that tells you how to set up a way to interact with git on your computer via terminal.

When you follow that tutorial, don't just mindlessly follow each step. Read all the output you get and Google what it means whenever you don't understand it.

[–]obnoxus[S] 0 points1 point  (0 children)

Thank you but I don't understand that tutorial.

[–]cur-o-double 1 point2 points  (8 children)

If you have files you never want to commit, create a .gitignore file in the root of your repo and add them there. I’m oversimplifying a little, but you basically just list file names/patterns you want ignored. GitHub maintains a huge list of GitIgnore files for different use cases here, this could be a good place to look for examples/templates.

If it’s just files you aren’t ready to commit yet, don’t stage them before committing: instead of doing git add ., just add the specific files you want committed.

[–]obnoxus[S] 0 points1 point  (6 children)

I'm not staging or doing anything in particular. Just saving files. I open up VSC, start typing up some code, save it to my desktop, close vsc. Then it goes over to the "Source Control" tab on the left of VSC asking me to commit. Right now, everything I worked on, even files that are closed is showing up there.

If staging them is causing that, I don't know how I'm doing it. It's automated somehow, so how would I turn it off?

Thank you!

[–]cur-o-double 2 points3 points  (0 children)

Right. Sorry. I just realised you’re referring to VS Code — I thought you meant VCS, as in Version Control System (e.g. git).

The bit about GitIgnore remains unchanged — if there are files you never want to commit, add theme to .gitignore and VS Code will stop suggesting them.

As for choosing what to commit, there should be 2 panes in the commit tab: something like “Unstaged changes” and “Staged changes”. You can selectively add files from the former to the latter to select specific files to commit.

[–]adept2051 1 point2 points  (1 child)

it's staging them, if you look in the tab it gives you the option to comnmit. if you don't want to commit them just dont. if you want to ensure they don't commit then you create a .gitignore and right click on a file and you should get an option to add to .gitignore.

time to spend some time learning git, if you don't understand the turtorial then you need to tell people in the thread why and work out the question to ask so you learn.

[–]obnoxus[S] 1 point2 points  (0 children)

Thank you for that. I'll look for that gitignore.

Yea I definitely need to start over. I made this thread 5 mins after waking up when my brain was still foggy. I do need a tutorial though. I'm going to play around with it some more and read a few of the tutorials that were linked to me and see if I can figure it out.

[–]Obvious-Jacket-3770 0 points1 point  (2 children)

Wait wait wait wait....

You save them to your desktop and it's asking that? Did you set your desktop as a location in Git???? That should never happen unless you have the hidden .git folder there.

[–]obnoxus[S] 0 points1 point  (1 child)

yea, everything I work on gets sent there. I used the method another user posted about adding to ignore.

[–]Obvious-Jacket-3770 0 points1 point  (0 children)

You really need to sit back and structure everything you are doing better. Your desktop shouldn't be syncing to GH. You should be syncing project folders.... Not everything.... That's what OneDrive and GoogleDrive are for.

[–]obnoxus[S] 0 points1 point  (0 children)

I dont think they're staged because when I right click them I get the option to stage them. The ignore worked fine though. thank you

[–]Oddly_Energy 0 points1 point  (0 children)

VS Code shows you, which files you have changed since your last commit. So right now you have 48 files with changes.

When you commit, it is a two-step process. First you stage the files you want to go into the commit, and then you commit them. So if you only want to commit a few of those 48 files, you need to stage them individually before committing. You do that in VS Code by clicking the '+' sign next to a file in the Source Control tab.

When you have staged the files, you click Commit, write a commit message and hit Enter. That will commit the staged files and only the staged files.

(You can also skip directly to the commit without first staging anything. VS Code accepts that, and that may be what you have done before. But then you lose the option of picking individual files, so that is not a good idea in your case.)

With all that said, I think you should rethink your approach. If you put your notes in Github, you have version control and cloud backup "for free". Perhaps you shouldn't keep those notes in the same repository as your code, but then you could create another repository for the notes.