Been using Git for 8 years. I guess this is the first time I am actually relating all the commands I use with what is happening behind the scene. The idea of not mixing git branch with a tree like branch is the key here.
@46:48 To get the file back via git you would need to (1) use "git log" to get all the commits and after getting commits (2) select the SHA before the file in which git was deleted, and then (3) git checkout . You will get your deleted file back in your working directory, but from there you would need to start a new branch. OR You could just rebase
Those are good tools but it can be far easier than that as long as you have not committed yet. If you just wan't to roll back the point after the system "rm" but before and/all "git add"s, i.e. still no working file but not staged either, use git reset --mixed (default action, anyway). "Mixed" wont change the working directory, only the staging-area (aka index). If you want the ENTIRE working directory to exactly match the present branch commit then "git reset --hard" will do that. The problem with reset is you may want to be a bit more surgical, file-wise, about what you are doing as you may have several items staged and you just want a file or two back. Be careful with "--hard' since all changes, not just one or two, are lost. In the case in the video this would be fine. The delicate way is "git checkout -- new-feature2.rb" as this will grab that one file, leaving all others intact. That double-dash is the key. This can be a list of files too. "git checkout -- " is not limited to just HEAD (head being the last commit of the checked out branch) and that means you can pull your lost file from any point in history. Three weeks ago---no problem! (as long as it was committed at some point) You can use "git log" or "git reflog" to find a commit hash, branch or tag and use something like "git checkout yeOldTag -- new-feature2.rb". Once the file is back just add and commit as usual.
using " git cat-file -t " for showing the type of the object and " git cat-file -p " for showing the content of the object was more useful to me than using " git show"
The more I learn about Git, the more terrified I become of Linus’s genius, should he ever decide to stop focussing on kernel development and turn to world domination.
I achieved the same style of the terminal with zsh, oh-my-zsh and gnzh theme of oh-my-zsh you guys do need to change that symbol to circle as default theme has an arrow as a symbol
There is a charge for private repos but it should work. It works fantastic for any text project including scripts. Helps on solo projects but would be invaluable when working collaboratively with a few or many authors/writers/producers. Deals well with markup like Markdown, LaTeX, Docbook, Lout, troff/groff/nroff, HTML, etc. so the document has consistent formatting throughout.
cs50 is genuinely the best thing out there on youtube. appreciate you all for this free lesson! really made my saturday more fun
One of the best videos out there! Thank you so much for this content!!
ls -h is not hidden, it’s “human readable file sizes”. -a is all files (including hidden) and -l is long form
that explains why ls -h just didnt work:)) but ls -la did work
Thanks for the vide! It was really interesting! I'm a senior dev, but didn't know some of the details. John is excellent at explanations, kudos to him
Glad you liked the video!
This is the best git tutorial on the planet
This video changed my life, I swear by it 😭
Woah, this is incredible, it was new for me to know that git does not stores diffs, instead it stores complete snapshot of our repo
Remember your first *git init* command 10 years ago? Started from the init and now we're here! lol
Great video thanks John. You are a very good and clear speaker.
Been using Git for 8 years. I guess this is the first time I am actually relating all the commands I use with what is happening behind the scene. The idea of not mixing git branch with a tree like branch is the key here.
Git from the bits up is another good talk which shows behind the scene: ruclips.net/video/MYP56QJpDr4/видео.html
@46:48 To get the file back via git you would need to (1) use "git log" to get all the commits and after getting commits (2) select the SHA before the file in which git was deleted, and then (3) git checkout . You will get your deleted file back in your working directory, but from there you would need to start a new branch.
OR
You could just rebase
Those are good tools but it can be far easier than that as long as you have not committed yet.
If you just wan't to roll back the point after the system "rm" but before and/all "git add"s, i.e. still no working file but not staged either, use git reset --mixed (default action, anyway). "Mixed" wont change the working directory, only the staging-area (aka index).
If you want the ENTIRE working directory to exactly match the present branch commit then "git reset --hard" will do that.
The problem with reset is you may want to be a bit more surgical, file-wise, about what you are doing as you may have several items staged and you just want a file or two back. Be careful with "--hard' since all changes, not just one or two, are lost.
In the case in the video this would be fine.
The delicate way is "git checkout -- new-feature2.rb" as this will grab that one file, leaving all others intact. That double-dash is the key. This can be a list of files too.
"git checkout -- " is not limited to just HEAD (head being the last commit of the checked out branch) and that means you can pull your lost file from any point in history. Three weeks ago---no problem! (as long as it was committed at some point)
You can use "git log" or "git reflog" to find a commit hash, branch or tag and use something like "git checkout yeOldTag -- new-feature2.rb". Once the file is back just add and commit as usual.
Camera work is great
Good point to learn more about Git. But it would be better to know something before watching this video. Then it will be more effective.
for some reason, he looks like Howard Wolowitz
so deep and clear, thank you!
Awesome presentation. Thanks for sharing.
Thanks Linus Torvalds
31:44 really shows how awesome git is.
I cry every time I see someone using ATOM. That was my favourite text editor. MS $%&u .
John Britton reminds me of Richard Henricks from Silicon Valley :)
Well, actually... John Britton reminds me of Howard Wolowitz from TBBT :)
Git's internal design is similar to block chain.
Superb 🙌
خیلی مردی ، دمت گرم، واقعا مطلب مشتی بود. لوتی گری کردی که یاد دادی داداش.
خخخخخخخخ
топовое видео по гиту
using " git cat-file -t " for showing the type of the object and " git cat-file -p " for showing the content of the object was more useful to me than using " git show"
The more I learn about Git, the more terrified I become of Linus’s genius, should he ever decide to stop focussing on kernel development and turn to world domination.
This is the best git-internal talk I've seen.
Is this a Harvard course? Or just a one-off session?
i recommend this one too , it was very helpful to me
ruclips.net/video/P6jD966jzlk/видео.html
How do I set up my terminal like his
Install Oh my zsh
@@DannySamuel i'm using the fish shell and oh my fish , what is the name of this theme?
@@tarikzaki5442 bira
Would have been great if covered merge also
how have I just today learnt about 'tree' command. wtf
Which shell is this is he using zsh ?
Same question
Rohan Gupta Yeah!! It looks like zsh
Es roy yes confirmed plus the oh-my-zsh framework with thr bira theme
Would guess bash, as that is the default for Mac.
(-h to ls(1) gives human adopted sizes reported by ls)
I achieved the same style of the terminal with zsh, oh-my-zsh and gnzh theme of oh-my-zsh you guys do need to change that symbol to circle as default theme has an arrow as a symbol
I find it hilarious that Git changed "master" to "main" to be politically correct but still has a command called "reflog" 🤔😂
how can i configure my console to look the same?
Which tool did you use for mouse cursor spotlight effect?
Mouseposé for Mac
PointerFocus for Windows
Projectuer for Linux
what is the prompt theme that you're using?
and this shell is bash ,fish or something else?
Looks like OhMyZsh, but I might be wrong.
"No network activity"
I wonder if comedians use github for joke development
There is a charge for private repos but it should work. It works fantastic for any text project including scripts. Helps on solo projects but would be invaluable when working collaboratively with a few or many authors/writers/producers. Deals well with markup like Markdown, LaTeX, Docbook, Lout, troff/groff/nroff, HTML, etc. so the document has consistent formatting throughout.
audio is somewhat low
31:05
ehm...