Комментарии:
I will still call it master and will encourage others to do so.
ОтветитьYou will not woke my git.
Ответитьwell, even if you execute "git reset --hard origin/master" you can still revert ALL local changes. "git reflog" is like a step by step history of all actions you were making local, eg. switching branches, stashing, resetting, etc., thatswhy you should never ever delete the ".git" directory ;)
ОтветитьI would add `git log -2` to view last 2 commits to your list and `git blame` to see who wrote this stupid line
ОтветитьGreat work 👏
ОтветитьI'm still waiting for the advanced techniques.
Cool for the Linus T apparition.
git commit -am doesn't work. It's a myth
ОтветитьIt's master branch all the way. Please don't bow down to this disgraceful generation of snowflakes.
ОтветитьIs that period key thing legit?!
Ответить`commit -a` is not equal to `add & commit` because it doesn't add untracked files for some inexplicable reason
--force-with-lease is better than just --force because it prevents you from an accidental overwrite of the origin
`stash save` doesn't stash untracked files IIRC
Just my opinion on aliases, especially if they only shortcut by some letters like your git commit -am vs git ac:
- It makes it less clear what you do when pair programming
- It makes it harder to copy+paste any commands you did in case of writing a README, put it into Teams/Slack or when pair programming
- It makes it harder to write scripts (you can either unintentionally paste your personal aliases or mix up the original commands as you are not used to them)
- When logging to a remote server or working/troubleshooting a colleagues computer, the aliases aren't their, so you still need to know how to use them and without practice, it's unnecessary complicated. Same is true for writing bash/CICD scripts etc.
- Having shortcuts for commands that do magic (auto committing) is a bit dangerous IMHO (ok. git commit -am doesn't have that big error potential, but still you can add unwanted files to the commit, at worst some containing passwords). If you have to type the full command, there's a better chance your brain switches to full attention mode.
- If you don't want to type unnecessary letters: better use autocompletion (exists for bash, zsh, ...) or use an IDE that still show what's going on in detail (emacs magit, lazygit, ...). Aliases and shortcuts adds complexity, while autocompletion reduces it. If you want to use aliases, prefer to use any more standardized ones (so colleagues could just install them with a simple command, like several zsh plugins and look them up easily).
O.K., most of it is personal opinion, and highly biased based on my work (where I often have to trouble shoot other people's problems), but I certainly wouldn't bring up aliases as first suggestion to work with git :-) - if at any all, as one of the last improvement possibilities ...
Didn't like the start at all. Don't just use "git commit -a" instead of "git add . ; git commit". As someone else pointed out, they are slightly differnt. Then you're talking about the "-am" flag, but that's not even true. It's two flags combined, "-a" and "-m". This might not matter at all. But it makes you look like someone who doesn't even understand shell commands. Then it get's better and better, although I really ask myself how slow you would have to be at typing so that an alias like "git ac" would make a lot of sense. Of course I use some git config as well, but I prefer to be able to do my basic workflow on any machine without first adding a git alias.
Ответить`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
Ответитьin git is hard to loose things forever, "git reflog"
Ответить"master" is the standard name, first step in git is to rename master back to master if needed
ОтветитьMeanwhile me that uses the github desktop app for almost everything
ОтветитьGod forbid we use the word master! People are so pathetic.
ОтветитьOne word: Magit
ОтветитьLife is too short to write branchName, use "git rebase - "
Ответитьwhen you do an interactive rebase, you can use abbreviations for the operations on the commits, s instead of squash, r instead of reword, d instead of drop
ОтветитьThe -m flag exists for people who are too afraid of vim and dont know about the $EDITOR shell environment variable.
ОтветитьBest git video in the entire world. Thank you for existing fireship
Ответитьgit is a linked list. Force commit is banned on most production repositories. (This may include rebasing.) Professional git has a lot of workflows and styles on it. Most agile software has a workflow on it too: story, issues, design review, code review, test, document, merge, release, etc. Most people are forbidden to push or merge onto master or any release branch. People are generally forbidden from pushing onto develop unless through merge/code review.
Some people hate squashing commits as they believe commits should be numerous and tell a story. This all gets into commenting opinions too. Some people believe many commits allows better regression and cherry picking. However others forbid cherry picking like done in SVN. (Some people have lost control of multiple branches doing this.)
On the first day of first job after college a guy told me do not break the branch (or something related to head) or I will be pissed. All I remember thinking is what a putz. Git when properly used, is used with a process. There should never ever be away for me to break anything. The second job I worked for understood this and actually took the time to show their people how to do this. Not the developers as they had quite a few putzs there. Their production build servers were basically playgrounds for kids, but they hired a guy to fix that. One of the things he brought was git and feature/develop/master/release branches. Trust me if you follow the process this kind of issue should never be possible.
First 35 seconds of this video and all I could think about was that putz.
incredible
Ответитьgit worktree
Ответить"advanced" ... yeah right
Ответитьi made my own git log with alias with the pretty=format option
something like
alias gl='git log --pretty=format:"%C(dim white)%ad%Creset %C(bold red)%h%Creset %C(bold yellow)%d%Creset %C(bold blue)%an%Creset %C(bold green)%s%Creset" '
alias gln='git log --pretty=format:"%C(dim white)%ad%Creset %C(bold red)%h%Creset %C(bold yellow)%d%Creset %C(bold blue)%an%Creset %C(bold green)%s%Creset" -p --name-only'
hope you find it usefull
I keep wondering if fireship is the same guy from neetcode. They both have the valley speech pattern.
ОтветитьAlso the dash "trick" works with cd. just "cd -" and you switch to working directory you where in on cd before. It took years to find out about that.
Ответитьnobody uses pull-requests in 2023, does it?
Ответитьlong live to master branch
ОтветитьRenaming all my branches to Masser
ОтветитьIt should be very rare to need to use "force". If you are working solo on a feature then do what you want, but when collaborating you should be pulling the remote changes often, and fixing conflicts from other dev code locally, then push up.
Ответитьman these videos are so funny and useful kudos to fireship
ОтветитьThis is too confusing, i'm just gonna delete the whole repo and clone it again.
ОтветитьI always name my master branch master. "Main" is politically correct trash forced by SJWs.
ОтветитьGIT is just a source control library exposed to the CLI as an API.
ОтветитьI try to use default behavior as much as possible, so the whole "change your master branch name to main because that's so 2020 woke" thing doesn't land. I have actually experienced problems with git repositories and ci/cd tools because of this nonsense. Either change the default behavior so it just works or stop bitching about how a word offends you on behalf of some imaginary friend.
ОтветитьI can't believe bisect is a thing!! I literally did it manually so many times!!! thanks!!!
ОтветитьJenkins is to Git hooks as angular is to JavaScript.
Just another tool to do the same crap you already can do.
I am so confused by merging conflicts. Not because I dont understand what is what, but because git just obliterated the entire thing
ОтветитьThe most important thing that should be on everyone's mind currently should be to invest in different sources of income that doesn't depend on the government. Especially with the current economic crisis around the word. This is still a good time to invest in various stocks, Gold, silver and digital currencies.
ОтветитьNice, now I know how to rename the "main" branch to a more sensible "master"
Ответитьgreat video
I'm still confused as fuck