The guy who created git seems really smart. He should create a kernel someday.
@DevAmateur3 жыл бұрын
Am I a certificated geek to understand this joke? :D
@ThotsAndPrayers3 жыл бұрын
Yeah, and he could call it something based on his name… something like Linuz or Linuks or something. 🤔
@MASTERISHABH3 жыл бұрын
@@ThotsAndPrayers Lunix would be better. People would find different reasons... One could say Lol Unix 😅
@TOn-fx2gr3 жыл бұрын
@@DevAmateur the guy is linus trovald and he created a kernel called linux
@DevAmateur3 жыл бұрын
@@TOn-fx2gr lmao, I said that I understood the joke
@vim_programar3 жыл бұрын
Good tip, do not use -force, this will make all your coworkers hate you, use -force-with-lease, this will only allow you to push the code if there are no conflicting changes with the current parent branch 👌
@sodiboo3 жыл бұрын
If you don't want your coworkers to hate you, then you should just git-blame-someone-else so they'll have that someone else instead
@jayjaayjaaay943 жыл бұрын
I usually use `git push origin +feature/name` it only push the current working branch which is usually we wants to force change
@ErikHuizinga3 жыл бұрын
@@bugs389 pfwl
@alextheheck3 жыл бұрын
came here for this, sound advice that more people should know about
@ClAddict3 жыл бұрын
We block force on Main for all but a few admins in the rare case a build system breaks underneath us which requires code changes to fix. Everything else requires a PullRequest.
@leoaso69843 жыл бұрын
Important note: "git commit -a" will only automatically add changes to files git is already tracking. If you create a new file, you still need to "git add" it.
@pesterenan3 жыл бұрын
Thanks, I tried to be all smart and use this new -am and now I am surprised to see none of my new files on the online repo...
@mikeguantonioify3 жыл бұрын
Usually I favor git add - - update This allows you to only commit changed files added to the repo.
@EverAfterBreak23 жыл бұрын
I can confirm this
@mgarcqnohaydisp3 жыл бұрын
Yeah, I'm all in for old-school in this aspect. Adding files manually first and committing in a separate command. As stated in the video "sometimes going fast lead to mistakes"
@dgmstuart3 жыл бұрын
I have an alias set up: gcad=“git add .; git commit -v” Occasionally I’ll end up staging stuff I don’t expect to, but using -v means I usually spot my mistake. VERY occasionally I end up committing something I didn’t mean to, but I’m confident enough with git to edit the commit before the PR gets merged, so for me the trade off is worth it.
@technikhil3143 жыл бұрын
alias uncommit="git reset HEAD~1" alias recommit="git commit --amend --no-edit" alias editcommit="git commit --amend" These are my all time favorite aliases
try this one alias lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)%Creset' --abbrev-commit
@IshanKashyap0019 ай бұрын
@@radadadadee Is this the masochist version of "git log --oneline -a --graph"?
@technomunk3 жыл бұрын
Instead of showing "--force" flag you should default to "--force-with-lease" which will avoid pushing the code if it would overwrite something you didn't anticipate (coworker's code)
@henriquematias19863 жыл бұрын
omg! that should be the default option for force : D
@andresreyes85093 жыл бұрын
does that flag have a short version? like how --force is -f?
@technomunk3 жыл бұрын
@@andresreyes8509 no, not as far as I'm aware unfortunately. You can always make an alias if you use it often enough.
@nrnjn85472 жыл бұрын
cant that just be replaced by a simple git pull and then git push.... ??
@martiananomaly2 жыл бұрын
lmao that seems kinda useless because --force is usually used to overwrite someone else's code. Otherwise just pull the code and push normally.
@Arrviasto3 жыл бұрын
The most useful git technique I've learned is understanding how it works internally (what is a commit and how it is stored, that a branch is pretty much a pointer to a commit etc). This allows for much more flexibility when it comes to managing your local repo. At work I'm constantly juggling commits between local branches, mixing and squashing them as I need them to. There is no problem in running cherry-pick on a branch to get its' top commit or pushing your previous commit to remote while current one is not ready. And also reflog.
@atishayjain11412 жыл бұрын
Can you make a video on this. I would love to learn from you. Because I am also facing the same issue and cherrypicking is so hard for me to maintain.
@electricathlete4299 Жыл бұрын
Can you please give me some insight on how it works internally please 🙏
@BosonCollider Жыл бұрын
That's mostly a sign that git is a leaky abstraction imho
@LuLeBe11 ай бұрын
@@BosonCollideris it an abstraction? To me it's a tool that makes it easier to copy code around and have messages and IDs attached to certain versions of it, instead of having separate folders for working on a new feature or so. There are some abstractions in the naming, yes, but even without all of them it's just a tool to avoid having tons of folders and a spreadsheet to know what's where.
@IshanKashyap0019 ай бұрын
@@BosonColliderL take
@NomadicJulien3 жыл бұрын
git switch: move your current changes to another branch. I regularly work on the main branch and then switch those untracked changes to a new branch then I commit them. The perfect use case is when you just want to test something, but you're not sure it's worth it. > git switch -c''
@aquelecanaldohugo3 жыл бұрын
I didn't know about that. I have been stashing my changes my whole life haha Thanks
@voyageruk20023 жыл бұрын
So would you do. Work on main branch git checkout -b newbranch Then won't it automatically take you to new branch? Then have to go back to switch again? How does it work?
@aquelecanaldohugo3 жыл бұрын
@@voyageruk2002 switch is a replacement for checkout. `git checkout -b` and `git switch -c` work the same. They created switch because checkout does more than just switching branches and now they are trying to make things more specific. To simplify the code base, I guess.
@thethirdtomas33 жыл бұрын
Yup. I use checkout -b Same results.
@andres1545254523 жыл бұрын
OMG THAT EXISTS??? WHAT A PAIN I HAD IN THE LAST COUPLE SPRINTS!
@isheanesunigelmisi84003 жыл бұрын
Let's take a moment to appreciate how this guy drops amazing content every other day. St. Fireship
@thecashewtrader33283 жыл бұрын
💓
@lbedoya133 жыл бұрын
3:21 ah yes, stash: "That's the code the project deserves, but not the one we need right now"
@TheBoab4003 жыл бұрын
I don't watch Fireship videos that often, but when I do they always blow my mind. Like, I need to watch them over & over to absorb all the things that are in them. Thank you so much for this, we developers need to master GIT for sure.
@stoef3 жыл бұрын
The quality on your videos is insane. The voiceover is amazingly clear and nice to listen to. The topics touched on are explained really well The graphics are on point.. Amazing stuff!!
@jayjolupoi888913 жыл бұрын
IKR, so undersubscriber
@shutanovac2 жыл бұрын
TBH the voiceover sounds almost like Microsoft Sam. I am wandering whether he automated the voice track by concatenating prerecorded word samples
@Mitchyugan Жыл бұрын
Nah, the guy is good fr
@gesit71203 жыл бұрын
git bisect blew my mind. I don't think I will need it in the future, but I love that this functionality exists
@christoferberruzchungata27223 жыл бұрын
This is heavily used when your code has tests and automated jobs. If you have Travis or Jenkins that run tests frequently, this feature allows to figure out which commit introduced a bug that it’s causing failures
@krzyczak2 жыл бұрын
You can also run it automatically by providing a script with exit vode 0 for success and non-zero exit code for failure and it will mark all your commits good or bad based on that automatically
@marco.garofalo3 жыл бұрын
One operation that I use quite a lot is "git add -p", which basically allows me to review each piece of code I changed/added/deleted in order to have more granular control over what I want to include in the next commit, and maybe squash the changes I didn't include, for later.
@nolanfaught6974 Жыл бұрын
I add -p to stashes often because I’ll change different components in my code and sometimes I need to filter changes out of the same files
@svenvancrombrugge90733 жыл бұрын
2:35 git revert does not "got back to the original state"; that's checkout / reset. git revert creates a new commit with the opposing changes effectively reverting the reverted commit (hence the name).
@charlesm.26043 жыл бұрын
Thanks bro
@augustday94833 жыл бұрын
Revert is what you want to use if the commit is already pushed to the remote. Reset is for if you haven't pushed yet.
@viacheslavromanov30983 жыл бұрын
Yes he mentioned that
@Dmitri_Ivanovich3 жыл бұрын
He said "without removing the original commit". How else would you "go back to the original state [...] without removing the original commit"? The only way is to create a new commit. So creating a new commit is implied here and you comment is superfluous.
@orkhepaj2 жыл бұрын
@@Dmitri_Ivanovich by deleting last commit obviously
@DevAmateur3 жыл бұрын
Extremely well explained video and added new stuff I did not know. The master rename to main is the stupidest thing I have ever felt in person about this new vibe of racism and sexism. It is ridiculous.
@ibrahimomer92633 жыл бұрын
No one is forcing you to do anything (hopefully anyway). However, when starting new projects, it really doesn't matter what you name your main branch, so why not go with the least controversial one?
@mormatus3 жыл бұрын
@@ibrahimomer9263 probably because not everyone wants to feel being influenced by snowflakes
@armynyus91233 жыл бұрын
@@ibrahimomer9263 Because at a certain point, you have to say STOP. Otherwise this bullshit will go on until we cannot communicate anymore w/o constant fear of hitting the next trap. In my country, Germany, the language is being completely demolished meanwhile... Think for a minute: Do you really believe the word 'master', especially in the absence of a 'slave' as here with git, did hurt a certain group of people so much, that they gathered together and started lobbying at microsoft, for their just case? So that microsoft bent, because the pressure from that group was so high, that they decided to skip the word master in github's default repo settings? If you believe that, I would like to know who those people were and how they started their campaign for their cause. Face it: That group does not exist. Nobody, not a single person, is *honestly* being insulted by git using the word master for its default branch. Just like not a single woman in Germany is insulted by the word Wissenschaftler (scientiest), which we may not use any more. You will HAVE to realize that this stuff is coming NOT from bottom up. It's coming top down, upon us. Then ask youself why, whats the reason. *Why* is this being pushed top down? Invest half a day - You'll find the answer easily.
@sm51723 жыл бұрын
@@ibrahimomer9263 Because the whole ‘controversy’ is idiotic.
@voxelfusion98943 жыл бұрын
@@ibrahimomer9263 master isn't a "controversial" word outside weird echo chambers.
@Sam-qn4ly3 жыл бұрын
Master will always be my main branch, It’s the master copy.
@philipoakley54983 жыл бұрын
Nah, the master 'copy' (oxymoron) is on someone else's server (Github?). Git's called a distributed VCS for a reason. As long as you have the same hash, you have the same Mona Lisa! PS the correct historical term should have been a slave copy, based on slave clocks, but folks back then went with the 'master' figure of speech
@Kevin-jc1fx3 жыл бұрын
Apparently, using the word master anywhere in your code or other tools is now considered as a reference to slavery. If you still have a branch in any of your repos called master, then congratulations you are racist. 😂 Welcome to the inclusive and diversified kingdom of Woketopia 😂😂😂
@nromancarcamo3 жыл бұрын
I am always using master even in new projects.
@philipoakley54983 жыл бұрын
@@Kevin-jc1fx Most folks simply don't know where the usage comes from. There is a distinction between unique masterpieces created by master craftsmen (such as the Mona Lisa), or the original ship's drawing of Titanic, and forced perfect replication, originally conceived to drive slave clocks from a master pendulum. The original reference is discussed in [1] R. Eglash, “Broken Metaphor: The Master-Slave Analogy in Technical Literature,” Technology and Culture, vol. 48, no. 2, pp. 360-369, 2007, doi: 10.1353/tech.2007.0066 where the 'master' analogy was used directly to call up the idea of slave copies. Given that perfect replication/copying is the hallmark of software storage, it fits the latter description better than the former. Learning takes time.
@mok60343 жыл бұрын
@@philipoakley5498 I guess it does not matter, nobody should be force to use "main", master is fine so it make no sens to change it just because someone want to see his ideologie in it
@nitroflap3 жыл бұрын
Sometimes, especially when someone's commit might overwrite the changes you did, removed something, etc, etc, you might wanna do a git rebase on another branch. It helps to just make your branch on top of that one without any consequences. But we need to be careful with it, since it can really mess up everything.
@Fireship3 жыл бұрын
That is good advice, I mention that in the full course.
@nitroflap3 жыл бұрын
@@Fireship Glad you liked it! Looking forward to that
@buntysingh73153 жыл бұрын
Its good practice to make a backup of your current branch and then rebase it with main/yourbranch.. learnt it the hard way
@nitroflap3 жыл бұрын
@@buntysingh7315 same
@kaleidea55383 жыл бұрын
@@Fireship I'm sorry for off-topic, don't know other way to contact... My top-level comment about the long list of Git GUIs seems to disappear, is it caught by youtube's spam filter, by any chance?
@nic_cage5 ай бұрын
My favourite one is "git add -p" to Interactively add blocks of codes, you can add and ignore them as you go through the changes in case you want to split the changes in multiple commits. A colleague showed it to me and it was 🤯
@ezkymos2 жыл бұрын
6:55 there's also the python pre-commit to check coding style with clang-format before commit. Very useful to be sure the remote only have clean code
@RobertBrunhage3 жыл бұрын
Amazing video once again! --force-with-lease is another awesome --force flag that reduces some of the risks regarding overwriting others changes 😎
@bruhgamer3173 жыл бұрын
'senpai' is the best alternative to 'master'
@vforsh3 жыл бұрын
I have renamed all my master branches to slave-owner
@skwisgaarskwigelf3313 жыл бұрын
@@vforsh Based
@abdoufma3 жыл бұрын
'goshujin-sama' is where it's at for me
@sodiboo3 жыл бұрын
git push senpai --force hmm, i wouldn't wanna forcefully push my senpai
@tictac10203 жыл бұрын
This is the only acceptable alternative to master.
@kreemcat3 жыл бұрын
Bookmarking this vid because I'm sure I need to rewatch it sooner or later LOL
@vaisakh_km3 жыл бұрын
I just made a personal playlist to just book mark his videos lol Everything is gold in this channel
@troythompson23 жыл бұрын
This was perfect Jeff. Being a pro member has really paid off. Keep up the great content my guy
@thisisneeraj71333 жыл бұрын
git cherrypick is also useful when we have to merge a specific commit im another branch to our Say main branch by directly referencing the needed commit and the new added commit is same as that commit in that branch from where it got picked but with a completely new commit id.
@testusercompany50553 жыл бұрын
git cherrypick is an underrated feature of git.
@thisisneeraj71333 жыл бұрын
Yeah
@studogYT Жыл бұрын
`git cherrypick -x` always.
@moh68233 жыл бұрын
Nice shortcuts!! D3.js in 100 seconds LETS GOOOOOO 🥳🥳
@DaVince212 жыл бұрын
I personally avoid git commit -a or git add . because it will stage and commit all new and changed files and it's important to be selective about what you commit if you happen to be working on a few things at once or just want to separate commits into chunks of specific functionality (so you can revert only those chunks if needed).
@RaulTavares Жыл бұрын
'git add -p [file-name]' 🙂
@sufiserious798 Жыл бұрын
@@RaulTavares what does -p do?
@eviltom8783 Жыл бұрын
@@sufiserious798The -p option let's you selectively add changes from a file instead of adding the entire file. Can sometimes be useful, i suggest you try it out yourself.
@TheRighteousDawn Жыл бұрын
This is the sort of shit I don't learn working as a solo developer man -.-
@AleksandarT103 жыл бұрын
Great video. I never understood Git in depth until i started using GitKraken. Having an UI is so more convinient and u can learn the things a lot quicker. Give it a shot and you will never go back.
@arjix87383 жыл бұрын
I actually find gitkraken confusing, git is more easy to understand.
@mormatus3 жыл бұрын
For me, it was exactly the other way around. I have a feeling that using a UI tool should be allowed only after you understand the git internals. But if you understand those, you won't bother yourself with using a UI tool - plain aliased commands are typically faster to type and execute, and bonus point - you are pretty sure what is going on. While with that that fancy tool you are left at the mercy of its authors.
@johnthetactician3 жыл бұрын
I use the git graph extension in VSC along with using the built-in git source control viewer that VSC has
@jonathanlevin76602 жыл бұрын
I never used the interactive rebase to squash, but you can do it manually as well: Assuming last common commit in both master and your branch is f8324b, then: git rebase --onto master f8324b git reset --soft master git commit -m "Your squashed commit name" Works like a charm!
@AdarshSingh-qd6mq3 жыл бұрын
You did awesome, In short span of time you deliver awesome content...
@SzTz100 Жыл бұрын
Been using Git for almost a decade, I didn't know most of you shortcuts. Thanks.
@riskingeuphoria3 жыл бұрын
I feel like these videos are someone watching how shit I am and prodding me with encouragement. like "here you go little monkey, use this hammer to open that coconut you have been hitting with your head for a few hours"
@MrAyush982 жыл бұрын
That bonus tip in the end blew my mind!! The others you come across whenever you Google issues you have with git. But that last one saves so much time especially on terminals that don't have autocomplete.
@Kai-en2xs3 жыл бұрын
if you cant remember the full name of a branch during checkout. put a letter then press tab, it will either autocomplete the branch name for you or it will lists all the branches starting with the prefix/letter you provided.
@ifelseprog3 жыл бұрын
That's a common feature of terminals btw
@user-ux2kk5vp7m3 жыл бұрын
@@ifelseprog completions are a shell feature, not a terminal feature
@ifelseprog3 жыл бұрын
@@user-ux2kk5vp7m yes my bad
@pavankeshavl8563 жыл бұрын
There's one more handy command.. To revert a PR merge and avoid reverting every commit, simply revert the merge commit by using git revert merge_commit_id -m 1 Here 1 means stay on the main branch and revert the merged branch changes
@Qrzychu923 жыл бұрын
sample usage of git hooks: you can make it extract a Jira ticket number from branch name and prepend it to the commit message automatically, so that when you merge branches, you can track all tickets that were merged just by looking at the commit message of the merge
@pavanbhadaja88593 жыл бұрын
I love your content and video style. Best part for me is how you use gifs that perfectly describes what you are talking about.
@ChrisHaupt3 жыл бұрын
"git checkout -" was a mic drop moment. Blew my mind
@MPXVM3 жыл бұрын
there's also a "git checkout -- ." to reverse changes not yet committed if changes are not needed for later, otherwise stash is the way
@timmy1113 жыл бұрын
The same thing works with cd. "cd -" to go back to the previous directory.
@sanderd173 жыл бұрын
Some nice tips. I didn't know named stashes, will certainly use them in the future. And the 'checkout -' will also be a time saver.
@TheSvs13 жыл бұрын
Another pragmatic, useful and time efficient video. Thanks!
@mattskov2917 Жыл бұрын
Best git video in the entire world. Thank you for existing fireship
@arjuntt26043 жыл бұрын
For the first time I knows most of the things that's explained in a video from this channel, Feels so proud, Ima wizard now. LoL
@stith_pragya Жыл бұрын
Thank You So Much Fireship brother...........🙏🏻🙏🏻🙏🏻
@shaderone073 жыл бұрын
This might help... `Git switch -c ` create and checkout directly to the new branch.
@undefinedvariable80853 жыл бұрын
I typically use `git checkout -b ` Many ways to git a cat I suppose.
@neur3033 жыл бұрын
The most important thing for me was to learn how the git graph is built. Not the details but the structure of the commits in general. Close to all operations update that graph. Visualizing what these operations do was most helpful. I love git extensions.
@AdroSlice3 жыл бұрын
I recommend against renaming the master branch in existing projects, it can break things. Then again, its best to have your branches be named stuff like "prod" for production and "dev" for development
@myfreetimeaccount94502 жыл бұрын
I'm good, I'd rather neck myself than rename from master to main just to please woke activists. Even if main is default I still rename to master.
@evancombs51592 жыл бұрын
Personally, I like to rename new repos back to master just to spite the word Nazis.
@Klayperson2 жыл бұрын
I name my master branch fuehrer
@Astech31 Жыл бұрын
I name my branches Toby…..
@IchiganCS Жыл бұрын
@@evancombs5159 Wait till they here that every usb stick is a slave.
@wojteksykurski2 жыл бұрын
Dziękujemy.
@ScottMaday3 жыл бұрын
4:05 I'm going to name the master branch "slave" just to be contrarian
@undefinedvariable80853 жыл бұрын
@@randomyoutubeuser8509 Weed out the "problematic" ones. It's a solid strat.
@hyhih03 жыл бұрын
Based and redpilled
@theclockworkcadaver70253 жыл бұрын
@@undefinedvariable8085 Exactly, if the word 'master' is too much for someone, we're definitely not gonna be able to work together.
@MuhammadbinYusrat3 жыл бұрын
When I subscribed to your channel you had about 80K subs.. just saw you surpassed 800K. Keep up the good work.
@theena3 жыл бұрын
2:45 lol I felt that. I am like a trauma surgeon when things go wrong with git. Gold as usual. Amazing tips.
@kaleidea55383 жыл бұрын
`git reflog` -- it's like quicksave ;-)
@ruturajnawale10 Жыл бұрын
This is such a well explained and clean video! Everything to the point.👏
@KayOScode2 жыл бұрын
I have always used main as my default branch name, but for personal projects, I now use master since they decided to make it politically incorrect
@miss-astronomikal-mcmxcvii Жыл бұрын
Ahh YES! The first trick you showed I use a lot when updating only modified files. I love the convenience of “git commit -am”!
@eus93 жыл бұрын
The best thing I did was start using a Git UI (e.g. in Webstorm) for git. I make far fewer mistakes and it helps a lot when doing complex rebase / conflict resolution. It's important to understand git fundamentals but why make it hard for yourself?
@amit-mishra2 жыл бұрын
Actually it's harder to leave keyboard and go to mouse that's it
@eus92 жыл бұрын
@@amit-mishra I don't need to leave my keyboard at all to use the UI
@1chaplain2 жыл бұрын
I like the part where he just explains the core function. No hand holding, no long explanations. He at least expects the people watching this to be competent enough to figure stuff on their own. Subbed
@devnol3 жыл бұрын
4:05 Next thing I know the police is outside my house confiscating all of my IDE drives because they use master/slave configuration jumpers
@Vicer_Exciser2 жыл бұрын
Bro!! Having the browser-based VS Code editor right there in repo is a game changer!! Blew my mind 🤯
@ablanchi3 жыл бұрын
How will you know what the master branch is if everyone is using a different naming convention?
@sodiboo3 жыл бұрын
because there is always a default branch, and not just a naming convention
@flightvision3 жыл бұрын
@@sodiboo Git does not have a "default" branch - the first created branch is the default. Github/-lab/Bitbucket added that functionality to their implementation.
@flightvision3 жыл бұрын
but you can rename the first created branch of course - effectively being the default for people cloning the repo.
@sodiboo3 жыл бұрын
@@flightvision Oh? really? I mean that does sound completely plausible, but how does git know which branch to actually pull if you clone with no extra parameters?
@icarofilho65243 жыл бұрын
Dude, Many People around their world had problems with their previous BDSM partners so calling the branch master might be offensive to them.
@Brunoenribeiro3 жыл бұрын
"git checkout -" will save me a couple years of life, thank you
@szymoniak753 жыл бұрын
@@user-tu6oh2op9s get a job
@Carlos123456789Mr3 жыл бұрын
git merge --no-ff performs a merge without fast-forwarding, so the graph still shows merged branches and their commits. This can be set in a global option. Another cool global option is autostash, so that git pull with stash, pull then apply the stash automatically.
@henriquematias19863 жыл бұрын
autostash sounds really cool! --no-ff i never heard of, good tip as well
@jeremyjones40192 жыл бұрын
@@henriquematias1986 Not fast forwarding is actually a terrible tip. There is nothing worst than a git log full of merge commits, makes it hideous and unreadable. It's a trunk based development anti pattern.
@henriquematias19862 жыл бұрын
@@jeremyjones4019 good to hear you point of view! i'm sure it's useful somehow for some people tough ( : thanks for bringing this up
@vizunaldth3 жыл бұрын
Timing couldn’t be better, thx!
@nodemodules3 жыл бұрын
Tip #14 alias pit="git " alias bull="pull " pit bull
@97salmankhan3 жыл бұрын
alias bush="push" alias world="origin" alias wide="master " pit bush world wide
@nodemodules3 жыл бұрын
git bush did 9/11
@eoussama3 жыл бұрын
This video feels like the first page of any StackOverFlow Git-related question's first page. I'm glad to be referring to this video instead of spoofing dust on the lost side of StackOverFlow.
@kotopult3 жыл бұрын
That is funny how you tell about “main” but still using ”master” in examples 😁
@philipoakley54983 жыл бұрын
In the main, You gotta be noticed..
@mateustymoniuk3 жыл бұрын
Great video! Even though I've worked with git for some time, there are some commands that I didn't know that would make my life easier, so thanks for that!
@abhishekvishwakarma90453 жыл бұрын
git cherry-pick is also my favorite to pick the commits(changes) from different branches to my current branch, sometimes helpful in testing new changes/features 🔥
@madugahej70212 жыл бұрын
Kya 'Chacha' kya chal raha hai ? Tumko college me sab log 'Chacha' 'chacha' kyu bolte the ?
@ninjaasmoke3 жыл бұрын
The comments section is somehow a better version of Stackoverflow with less hate toward new developers. Loving it
@Green-pm6wk3 жыл бұрын
Hey fireship, I think these tricks for terminal git commands are all cool, but I personally believe in the supremacy of GUI's for git. Originally I fell in-love with GitKraken, ended up getting the pro version, and since then I've converted my entire team to using it. While it does bar you off from some the optional commands / flags you can use in your terminal, I feel it includes all the most important git utilities (checking out, commiting/pushing, ammending, reverting, rebasing (also interactive-ly), merging, stashing, and even more) whilst also providing you with an extremely intuitive UI for a git repository's state. About half of the tips you showed in this video I believe can be handled more cleanly in a GUI, the useful ones that I like doing in GitKraken being bisect, interactive rebase, pretty logs and stashes. Just being able to see a project's entire history, who made each commit, the relationship of all branches to one another, are all extremely valuable features on their own.
@silak333 жыл бұрын
I personally only think I really began understanding how git works properly after I started using the console version but that might just be me. I would also have a hard time working without the git-worktree command ¯\_(ツ)_/¯
@florianhennig4778 Жыл бұрын
Yes! Just wanted to second that. Also it has some nice features like adding hunks and partial stashes (for hunks and files). Even though that is possible with some CLI magic too in GitKraken it is way, way easier. For the SSH "I don't have an graphical environment at all" people I can also recommend lazygit, which is a pretty neat TUI for git.
@lazyteddy1234562 жыл бұрын
the github tip was actually incredible. Thank you.
@viccie2113 жыл бұрын
I know this is controversial, but I really like to use a UI for git. Personally I use Fork. It just gives you a nice graphical overview of the brances, stashes and currently staged files. Especially for beginners it's easier to wrap your head around everything with a UI.
@danieladesubomioniya10843 жыл бұрын
After years of using git, I'm blown away @2:00
@alanbixby3 жыл бұрын
Twitter: "everyone should use main instead of master!!" Most Devs: "nah"
@AnotherAvaibleName3 жыл бұрын
Agreed
@kavustock3 жыл бұрын
Do not bend a knee to an ideology that tells you 2 + 2 = 5, men can get pregnant, and gender is a social construct. We have to push back against the woke insanity.
@undefinedvariable80853 жыл бұрын
Medium: "everyone should use main instead o-" Most Devs: "nah" Devto: "everyone should-" Most Devs: "nah"
@theclockworkcadaver70253 жыл бұрын
@@kavustock 100%. Don't allow your enemies to define the words you use.
@runeh30223 жыл бұрын
Another pointless woke thing then? *sigh* Have they not considered the minority of sexual submissives might prefer the term "Master"? Shame on them.. :-P
@nikensss3 жыл бұрын
Oh, I was really wishing for what the bonus trick does, haha! Something that I do often when before opening a PR is doing ‘git reset -soft {destination-branch}’ so that my changes are not lost, and then reconstruct the commit history. This helps build a cleaner one. Then do ‘git push -f’ and that’s it. But, of course, be careful with the ‘-f’.
@mindless1013 жыл бұрын
When creating a new branch and switching over to it traditionally you would use git branch new-branch git checkout new-branch This can be done with a single command git checkout -b new-branch
@nishanths96523 жыл бұрын
We can use: git switch -c
@arulwastaken3 жыл бұрын
@@nishanths9652 its switch only right, checkout -b used to create new branch
@ballistik-o6fАй бұрын
great xontent; fluid and straight to the point 👍
@gwilhermfolliot58673 жыл бұрын
git rebase > git merge when updating a feature branch from dev / master
@ZnSstr3 жыл бұрын
damn this dude is pro at advertising, I couldn't even grab the mouse to fast forward and he already ended his ads, if I use an arrow I skip too far, well played
@marcotroster82473 жыл бұрын
Idk, those Git CLI commands are only for masochistic guys. I mean, the VSCode Git plugin and GitHub/GitLab UI are there for a reason! They visualize the diffs properly, simplify staged commits, assist you at resolving merge conflicts, let you modify the squash message before merging the feature branch, show you which commit made the CI/CD break, etc. Why not use those tools instead? It saves lots of time if properly used :D And btw, great work @Fireship ;)
@nbecnbec Жыл бұрын
Oh wow git bisect looks so powerful. Finding the issue in O(log n) instead of O(n) is a huge improvement.
@abdullashafi5803 жыл бұрын
still remember this "Nvidia 0:23 you ".
@codebreak88903 жыл бұрын
😂👌
@localattucson Жыл бұрын
Thanks!
@weeb32773 жыл бұрын
"git stash save" has been deprecated in favor of "git stash push".
@calloq1035 Жыл бұрын
`git reset -hard` doesn’t delete your changes forever. You can always get them back using `git reflog` and creating a new branch referencing the dangling commit that had your old changes. Just make sure you do it before it’s garbage collected
@Jaybearno3 жыл бұрын
Thanks for the social warning. I will start naming all branches just 'branch' so that no one feels left out. I'll also start adding random ascii characters to binary files to make them more inclusive of other bits. It might be a small adjustment in the short term but ultimately worthwhile.
@Vietnamkid19933 жыл бұрын
This is the video I needed! I spent several work hours trying to fix a committed bug.
@rrraewr3 жыл бұрын
I will never stray from calling my master master. Any other name would be disrespectful.
@mm74903 жыл бұрын
That github vscode thing is life changing. Thank you
@ViieeS3 жыл бұрын
04:05 master branch renaming is so stupid 🤦🏻♂️
@SumanthLingappa11 ай бұрын
Great video as always. the first tip `git -am` will add the git-tracked files (not all the files)
@NZAnimeManga3 жыл бұрын
sticking with master, I don't like being dictated to by seditious ideologues.
@Leftnutrightnut3 жыл бұрын
This man does not stop, and I don’t want him to
@NazmulHo19713 жыл бұрын
Today's Challenge: Speak rapidly, "Get Good At Git"
@abinahsahoo81353 жыл бұрын
I love his speed
@TheRealisticNihilist3 жыл бұрын
That's just _Bleed_ by Meshuggah
@undefinedvariable80853 жыл бұрын
Tomorrow's Challenge: create a git shortcut for today's challenge.
@bradleyturek3 жыл бұрын
Want to undo just some files? Try `git restore -SW `. `-S` unStages the file and `-W` undoes it in the Working directory.
@mdnazmulh.89083 жыл бұрын
The next challenge: play the video at 0:02 with 2x speed
@jpdominator3 жыл бұрын
My brain would melt
@0brooo4 ай бұрын
Fireship is the only channel I can’t watch in 2X speed. Pretty sure he speeds up the video before posting
@Oroshimisu3 жыл бұрын
Amazing video thanks ! Anyone know from which tv show is the clip at 2:23 is from ?
@dixztube3 жыл бұрын
I’m sorry as a black developer that master nonsense upsets the hell out of me. Vapid nonsense no one cares about changing not one black developers life but to confuse their learning. So stupid
@leoingson3 жыл бұрын
Thank you, Rich.
@TheDragShot3 жыл бұрын
I wholeheartedly agree and as such refuse to move away from *master* for stuff that isn't big enough to need a lot of people and branches. Master records have nothing to do with people. If someone is unable to understand this distinction then I can't trust their ability to develop software that works.
@karakunai_dev3 жыл бұрын
I thought the change from master to something else is just a trend or even a norm for some people, like seriously. I guess I'd need to browse the internet more often these days and get out of this cave I've spent most of my time into just to code...
@1XXXJoker3 жыл бұрын
People changing the branch names also broke some of my scripts, which was unnecessarly annoying ...
@janism943 жыл бұрын
based
@amaliabryant73413 жыл бұрын
OMG Where has this been all of my life??? 🤯
@modestas28903 жыл бұрын
Nothing wrong with the word master
@TeHzoAr3 жыл бұрын
yes there is
@ben_13 жыл бұрын
@@TeHzoAr please elaborate...
@ru31k323 жыл бұрын
At 7:19 there is a way of coming back from "eternal deleted files". Using `git reflog` you can see a log with all your changes, grab the hash you want to go back and execute `git reset --hard ` to recover or `git checkout ` to created a detached "session" so you can see the files in that moment.
@moritz58410 ай бұрын
Never use --force, use --force-with-lease
@kdbcinco3 жыл бұрын
This content is supported by: ✨Viewers like you ✨ This warms my core.