Hacker Newsnew | past | comments | ask | show | jobs | submit | p2e's commentslogin

As someone new to git, I was dissapointed to see that:

    git add "*.txt"
added all of the .txt files from the current directory AND all of the .txt files contained within a subdirectory. I would have expected the same files to get added as those that would have shown up using:

    ls *.txt
For other new users: I've been told that this is an error in the tutorial. The tutorial forced the use of quotes but apparently they are not required and git would have added only the files that show up with the ls command as indicated above.

EDIT: I'm wrong. Using quotation marks DOES make git fetch .txt files within subdirectories. As pointed out by cellularmitosis, git seems to do it's own "interesting" glob expansion.


Nice Find! I added it to my git-themed twitter account here: https://twitter.com/#!/gitHater

Let me explain what's happening.

What you are looking at is actually part-git, part unix-shell-y.

You did ls * .txt

Let's try something way crazy, type echo * .txt

What do you see? All of your txt files right? But that's just echo, not ls.

Ahh. Here's the clinch. When you do " * ", that's called either shell "expansion" or "globbing" depending on your shell. Basically, the shell says "ok, before I run your command, I'm going to look at it and see if I need to do anything on my end"

This is why you can do

   $ n=0
   $ echo $n
The shell hijacks your input, replacing "$n" with "0", then feeds it into echo

In your example, the shell has hijacked the star in "ls * .txt", replaced it with all of your txt files, say (a.txt, b.txt) and then ran ls.

That means that ls ACTUALLY got

   ls a.txt b.txt
And THAT's why it works with echo.

---------

So git add "* .txt" works differently, what gives?

Well, when you put things in double or single quotes you are telling the shell "hey, don't do your usual stuff here". The single quotes are more extreme. If we go back to our n=0 example we can try two more things:

   $ n=0
   $ echo $n
   $ echo "$n"
   $ echo '$n'
As you can see, the ' says "relax shell, I have this".

So when you do

    git add "* .txt" 
you are actually passing the "* .txt" to git.

In most reasonable, sensible programs, the program will look for a file named "asterisk dot t x t" in this case.

But alas, our friends at git have decided to be tricky. The ' * ' syntax for git is similar to gitignore-like syntax (http://www.kernel.org/pub/software/scm/git/docs/v1.7.10/giti...)

"Awesome", you exclaim! Not so fast. It's not the same.

So git add '!1' doesn't work. git add 'one/ * * ' doesn't work, only git add ' * ' seems to work.

Why is it so hard? Good question! I haven't any idea. But we can commiserate together ... you know, over twitter.

Have a good one!


It had you use `git add '* .txt'` because there were untracked txt files in the octofamily directory. `git add * .txt` would have just added the txt files in the root of the directory and ignored the octofamily directory.

I wouldn't think this is so much an error as they _want_ you to use '*.txt' to add the files in the subdirectory along with the files in the root. They could have touched better on the difference between quotes and no quotes though.


for those who aren't familiar with the nitty gritty, what's happening here is that bash (your shell) expands the "glob" (* .txt) before it ever runs ls, so what actually gets run isn't 'ls * .txt', it's 'ls foo.txt bar.txt dog.txt' etc.

but when you put quotes around "* .txt", that tells bash not to expand the glob.

so in the above case, '* .txt' is actually getting passed into git, rather than 'foo.txt bar.txt dog.txt' etc. I'm not a git user, but it sounds like git has special handling for "* .txt" which causes it to perform its own glob expansion, which happens to also include descending into directories. hilarity ensues.

EDIT: I can't seem to figure out how to type * .txt without triggering the italicized formatter, so I had to put a space after the asterisk. urgh.


I tried varying my commit messages from those recommended, (e.g., in the second commit, I typed 'git commit -m "Commit all the things!"'), and the commit messages weren't reflected in the "git log" output. It's not clear to me now how much of this is canned response and how much actually runs git.


I agree. I kept trying to "ls" and observe what was going on between each command or examine the directory structure of /.git and so on. Only later did I realize that there was a filesystem explorer-like window below.

Also, having them automatically adding files to the directory was kind of confusing. Sometimes I would type a command and something new would appear in the file system as a result of that command. Other times, I would type a command and something new would appear in the filesystem that I suppose was expected to be used for a subsequent step. It would have been nice if these things would have happened in isolation from each other. That way I could run the command, see what happened, and then perhaps click "next" to move onto a different scenario with a new set of files I could add to the repository.


My guess is that he doesn't edit videos after publishing because he likes the youtube stats?

Maybe youtube isn't the best medium for his videos and he should instead find an option that allows and easily facilitates future edits.


Why not just re-record the video, or design the videos such that they can be stitched together from small manageable sub-videos that can be easily and quickly re-recorded. There are plenty of times when he "clears the screen" and these would be perfect opportunities to edit together "good" sub-videos in the lesson.

I don't see why you would want to leave the mistakes in there. Someone might not grasp the correction!


I think that this is a serious issue. Khan usually just hits record once, publishes, and never revisits his videos again. By his own admission, he takes some initial feedback (first few video comments) from his videos but only applies it to his subsequent lessons not bothering to fix the prior lessons. This allows him to produce a lot of content, but it can end up doing more harm than good by keeping a lot of bad lessons out there.

I've seen quite a few of his videos that have had serious problems in them, 20-second long stretches of silence when he's erasing or fixing mistakes, and places where he talks himself (and the listener) into a circle. I just don't see why Khan doesn't take the time to fix obvious mistakes/issues in his videos -- or have someone else do it! Sure, it means more video development time but it's for the purpose of producing superior lessons and not spreading misinformation.

Traditional educators revisit topics/lessons and learn from their previous attempts and from student feedback. This allows future lessons on the same topic to be more refined and better serve the student. Who honestly believes they get something right the first time, or doesn't try to improve something when they, or someone else, identifies an obvious problem?

Khan has an excellent framework in place, but he needs to revisit his content. Or let someone else do it -- do these videos have less value if someone other than Khan comes in to fix things up? I'm sure there would be plenty of volunteers. Obviously the guys in this video had some good insight that could have helped Khan's video.


"My conclusion is that college lectures really aren't an efficient way to disseminate education, and they are even less so when they are recorded on video."

I'm curious about how you came to the conclusion that lectures are less efficient when they are recorded on video. It seems to me that (for the student which doesn't speak up and engage the instructor in class -- most students?), that a recorded lecture would provide a near identical experience. I would expect that recorded recorded lectures would also allow students to slow down, decompose, repeat, and revisit portions of the lecture in order to better grasp the information at their own pace.

Is it the issue of not being physically surrounded by students or faced by an instructor that you're not keen on? Perhaps a lack of physical accountability to keep students attentive and on-point?


For me personally, if I have the opportunity to ask questions, I will think of questions to ask and as a byproduct, think about the lecture more critically. If I am unable to ask questions, I am less likely to think critically. Of course, I have just realized this and now that I am aware of this, I can possibly put a stop to this and get more out of video lectures and even real life lectures where questions are discouraged.


The major difference is lectures of Khan Academy, or the new Stanford lectures have a one-to-one lecture format, that probably engages people more.

College lectures, or classroom lectures are non-ideal [1], in an ideal world, each student would have a corresponding teacher. The beauty of technology and Internet is that now we can simulate one-to-one lectures for masses.

[1] There are probably some situations where classroom lectures are better, when the lecture is enhanced by questions via discussion.


Efficient was the wrong word. The reason videotaped lectures are worse than being there in person: I often can't see the board on the video, and I can't ask questions.


It seemed to me that he did read the entire post and simply provided his own commentary/experience on the impact of adding such notes to one's file at Google.

Edit: I just noticed the comment you replied to has a more recent edit-time than your comment... Apologies if I missed something here.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: