10 Must Know Git Commands That Almost Nobody Knows

preview_player
Показать описание

Git is complicated which is why most people only learn the basics, but if you spend the time to learn the more advanced features of Git you can really improve your skills as a developer. In this video I cover 10 of my favorite Git tips, tricks, and commands.

📚 Materials/References:

🌎 Find Me Here:

⏱️ Timestamps:

00:00 - Introduction
00:46 - Add/Commit Tips
02:46 - Aliases
05:02 - Revert
06:32 - Reflog
07:21 - Pretty Logs
08:05 - Search Changes
08:52 - Stash
09:57 - Prune Branches
12:03 - Bisect
14:05 - Reset

#GitHub #WDS #Git
Рекомендации по теме
Комментарии
Автор

git stash is also handy when you made changes in the wrong branch :) stash; change branch; stash pop

stevebriggs
Автор

What a nice video. I’m bit suprised you didn’t add rebase —interactive, by my opinion is one of the most amazing and underused git commands.

Pilecek
Автор

The "reflog" in "git reflog" is short for "reference log". So, "ref-log" is a git command; "re-flog" is what your boss does to you when you once again miss your sprint deadline.

mykalimba
Автор

How have I gone all these years never knowing that git log has a content-search option? 😮 That is *so incredibly useful.* Same goes for bisect! Thank you for this video!

IceMetalPunk
Автор

Great video! I'm pretty sure that even after a git reset --hard, the commits still exist in your local repository, they are just no longer pointed to by HEAD or master, but they could still be referenced (and resurrected) by their commit hashes. The reflog is a history of which hashes were pointed to by HEAD in the past, so you can use that to identify the hash that HEAD pointed to before the commit.

russellblack
Автор

Very informative video. The good thing I learnt today is how to make aliases, especially for `git add .` followed by `git commit -m "some message"`. So, I really like the trick of `git ac "some message"`. It will surely save my time. Thank you Kyle!

jamshediqbal
Автор

You can also `git reset --hard HASH` too if you need to reset your changes to a specific commit. I didn't know about `bisect` and that looks super helpful. Another great video Kyle!

markbusnellijr.
Автор

honestly i haven't met most of the issue after i started to use gui version control, it is just so much better to look at visualize information

waiwaitea
Автор

This is extremely useful stuff, I always find myself messing up using GIT because I never really took the time to learn the commands properly and simplify the commands.

siamrahman
Автор

For the git-revert example, you should've shown how to revert a merge commit as that is very commonly the usecase

SevenElevenII
Автор

Absolutely amazing video. We want more of this please

shakedrosenblat
Автор

Instead of teaching people to stage all files in the directory, you should teach people to only stage and commit the changes they intend. That is done with `git add -p` and `git commit -v`.

This is a good video about how *not* to use git.

ThorkilKowalski
Автор

Probably the best git tutorial I've seen the past year. To the point. Thanks!

LewiUberg
Автор

my tip is use :x (or ZZ) to quit vim in those revert (and many other) situations. saves you 2 (or 3) keystrokes over :q!, probably many times over throughout your day

rubylily
Автор

Very informative and quick video.... Thanks bro 👍

sruthireddy
Автор

git reset doesn't actually delete commits when you reset to an old commit, because you still can reset to one of the later commits or cherry pick it. The way I see it is that the command just leaves the commits that you dropped dangling with no way to reach them unless you can refer to them through their SHA (short or full).

MrMMohsen
Автор

You oughta do a short on rebase. Best thing ever.

MrTimRJensen
Автор

There are also ways to prune local branches that were committed into a given branch. We use this weekly on the code base I work on at my job so that the overall git repositories stay clean. The nice thing is that it won't get rid of non-merged local branches, so changes you're still working on that haven't been pushed to the remote stay in place allowing one to continue working in them.

thisisatonofbs
Автор

Great video! the most important thing to remember is that everything is fixable, i see a lot of juniors get all stressed out over simple fixable mistakes so no worries :). Again, Awesome video!

codeWithJudah
Автор

git reset actually does not delete anything. it just forces the tip of your current branch to a specific ref, be it a branch, tag, or commit. if you remembered the commit hash your branch was at before using git reset --hard origin/main, you could just do a git reset to your old commit hash. this works until these unreferenced commits are deleted from the graph via garbage collection.

Marty