1

Okay...so i'm not the most technical with Git. I initially learned some basic things in the command prompt/terminal. That was 2 and half years ago though and have not used it, the web, or a GUI since then. I doubt I learned exactly what I'm asking about anyways. Disclaimer done....

Is there a way to restore "ignored/discard changes" to visibility within File Explorer?

I'm doing a Coursera course. Basically long story short, all the notes I've kept are inside folders within the repo folder. I was either ignoring or selecting discard changes or each of these individual files, when I was doing commits to recognize my progress (completing exercises and assignments), as I didn't want them to clutter what I was sending to my Github profile. I was only trying to show the actual work, not the notes I snipped. I was not aware that doing this would not make them visible in my File Explorer.

  • I'm not sure I grasp the entire issue, but if something was ignored then it wasn't version controlled and thus cannot be restored. Similar for discarded changes. As far as I know, you can only restore what has been committed. – pylang Nov 16 '16 at 04:48
  • You can confirm if a file is ignored via https://stackoverflow.com/documentation/git/245/ignoring-files-and-folders/2209/checking-if-a-file-is-ignored#t=201611160450555108754. If they are ignored, then your local repository doesn't need to be restored as the changes are already present. If you discarded changes, then those changes are gone. You would have to restore to backups of your repo. – pylang Nov 16 '16 at 04:56
  • @pylang the issue is that my notes are gone, because I did not want to include them with what I was sending to my Github page. So basically anything that is ignored is effectively deleted? – user3481334 Nov 16 '16 at 05:09
  • Not quite. If something is gitignored, it just doesn't get version controlled (or sent to GitHub). It sits in your local repo with all the changes. Git doesn't know it's there basically. So your changes should be there. But if it isn't gitignored, then it IS version controlled, so discarding changes means changes they are gone. You have to resort to restoring or timemachine or a backup (something non-Git). – pylang Nov 16 '16 at 05:31
  • Okay, thanks. So i'll need to go through all the videos and resnip all my notes... because they aren't there locally. – user3481334 Nov 16 '16 at 06:51
  • Possibly. Then add them to gitignore. – pylang Nov 16 '16 at 08:51

1 Answers1

0

I want to clarify some points here.

1) If a file is in your ignore list (.gitignore), it does NOT means you can not checkout it. Usually, if you commit a new file to repository, the a .gitignore is added to ignore that files. In this occasion. you call also checkout that file, but modification made to it will be shown on your modified files list when you run git status

2) If you want to check whether a file is on tracked status, you can run git ls-files

3) If you ever commit a files to repository, and delete it from repository thereafter, you can find it by git log --all -- **/thefile.* or git log --all -- <path-to-file> see git-how-to-search-for-a-deleted-file-in-the-project-commit-history for more details.

Community
  • 1
  • 1
gzh
  • 3,507
  • 2
  • 19
  • 23
  • Well, i'm running GitHub desktop. Not sure how that effects working with command line. As I initially said I learned about Git and Github long ago and never used it after that. I don't really remember anything and probably just shouldn't have bothered with out relearning some things, like i'm relearning everything else I had before lol – user3481334 Nov 16 '16 at 08:02
  • If you are using Windows, you'll want to open a command prompt or Git Bash which should have installed with Git. Then you can try the command @gzh suggested. I recommend using both so you can see visually what commands do in GitHub GUI. Just remember, the desktop version takes a few seconds to update when a command is issued. And, make sure to backup repos regularly. Despite popular belief, Git actually is not a backup tool, so you need both :) – pylang Nov 16 '16 at 08:57