When it comes to command typos, you can configure `help.autocorrect` to use a suggested command automatically. You would have to set a timer, so with `git config --global help.autocorrect 20` it will enable auto-correct and suggested commands will run after 2 seconds (1 would be 100ms). So if you want your command mistakes to still work without having to create a bunch of aliases, this is a nice way to do it.
I almost never comment on videos, but I have to do so here. Your content, production quality, edit, and voice-over are brilliant. You should really make more videos.
Just 2 videos and I learned a lot about git. I just started to use it and it's super helpful! PS.: For every "Let me know in the comments if you'd like a full video..." I'm saying yes!
I use git stash all the time, especially when switching between branches for doing code reviews. I'll start working on a new feature on a feature branch, and if I need to fix a bug in my code review on another branch, I'll do a git stash, git checkout other branch, fix bug, git checkout feature branch, then a git stash pop
This is really cool content, I've always wanted to do better in my git usage as a student so I don't bring any bad habits or practices into an actual collaborative project. I'm going to tell my friends to watch ur videos for tips and tricks!
good video as before. but the previous one was *fire*! because you took one single tip and explained it in great detail with animations and visualisation! THAT was the kill feature. the visualization! one small animation can explain more than a 1000 words. i know that it means more work and effort for you, but it works better for viewers than anything else. thanks for the work! looking forward for more :)
If I need to force push something, I use the alias `lease = push --force-with-lease --force-if-includes` to have a very safe way to do it. In short, it will abort if there are any new changes in the remote, so it avoids deleting another person's pushed commits. It ensures that any updates from the remote have been incorporated locally by rejecting the forced update if that is not the case. I used to only use `force-with-lease` and never needed `force-if-includes`, but since I'm using an alias either way, might as well use both.
OK. You have my subscription. I've been using Git for many years and you just made me feel like a newbie. I might make this required viewing for my team.
Great videos. In my opinion beginners struggle the most with reverting changes and with merges. In my opinion one of the most beneficial aliases is to do some graphical branch visualization like „git log --graph --decorate --oneline“ and similar. I see a lot of colleagues using extensions, tools like SourceTree or gitk or representations in Gitlab to display that, but then you always have to switch tools. In my opinion it is great that you can get the same in git-terminal.
Thanks for the kind words and the suggestions! Hmm, I do think that the CLI representation of the branching structure is a bit difficult to interpret, especially for beginners. I myself prefer using GUIs. If you put the gui in your path I think the tool switching isn't too bad - I use 'stree .' all the time to launch SourceTree from the current repo.
Since you are using those aliases in the command line, you can even register them in it's configuration (.bashrc etc). Inside corresponding configuration file: alias gcm='git commit -m' alias gs='git status' alias s='git status' It's a preference thing, but by doing so, `git st` will become `gs` or even `s`. By the way, loving your vids, keep it up!
Thanks for the kind words! Yep! Original plan was to release one every Monday but these take 30+ hours to create. So let's see how long I can keep it up or at what frequency I'm going to arrive at ;)
omg this video is a gem 💎💎💎💎💎💎💎 for me i use *PowerShell* aliases : gco branchName -> git chechout branchName gsw branchName -> git switch branchName gsta -> git status gst -> git status -s gbr -> git branch how to do it: 1- open PowerShell 2- run -> vim $PROFILE (it opens powershell profile file for configuratoin in vim) (if you are not using vim : run -> echo $PROFILE ,this will print the path of the file and open it with any text editor) 3 - past this : function gco($branchName) { git checkout $branchName } function gsw($branchName) { git switch $branchName } function gsta { git status } function gst { git status -s } function gbr { git branch }
The two alises I use the most: fetcho = fetch origin master:master [pulls remote master changes into local master while being on feature branch, usually followed by a merge] pulls = !git stash && git pull && git stash pop [when local changes prevent a pull]
You can restore a file deleted with 'git clean'. When using VSCode, create an empty file with the same name, then select this file in the Explorer, and click the 'Timeline' tab at the bottom left to see all changes for this file.
I'd love a video about fixing merge errors. I do it constantly at work but it's always difficult. There's got to be some trick I don't know. I use VS code as my editor and it surely has a good process for this that I just never learned.
I would love to see a video about fixing git errors, I got this error and have never been able to fix it. “warning: Pulling without specifying how to reconcile divergent branches is discouraged. You can squelch this message by running one of the following commands sometime before your next pull: git config pull.rebase false # merge (the default strategy) git config pull.rebase true # rebase git config pull.ff only # fast-forward only You can replace "git config" with "git config --global" to set a default preference for all repositories. You can also pass --rebase, --no-rebase, or --ff-only on the command line to override the configured default per invocation.” I had made commits to the same branch on different computers I was able to push one to the origin but the. On the other computer I tried to do a pull and got the error above. I tried the 3 suggestions and was not able to get them to work. The only way I got back to a working state was deleting the repo on the second computer and recloning it back down.
Thanks for the suggestion! Might do a video on that in the future :) Not sure what happened there in the repo, but I'd suggest running `git config --global pull.rebase false`. This will set the default pull strategy to 'merge', which was the default in git for a long time. Then refer to my other video to help you decide whether you want to use the default pull or pull --rebase in the future. Let me know if that helps or if you have any follow-up questions :)
Hey, thanks for your suggestion! I did use master at one point in the video, but only to show how sometimes people are confused because they're used to pushing to master, when now it's called main. But I'm totally onboard with you!
My favorites I use daily:
- git fop = git fetch origin --prune
- git mofo = git merge origin/master --ff-only
- git edit = git commit --amend
- git forgot = git edit --no-edit
- git hist = git log --one-line -10
- git dw = git diff -w
- git dws = git dw --staged
- git swh = git show -w HEAD
I also use it for common mistakes I make while typing the commands:
- git rbanch = git branch
- git stats = git status
Oh man I'm gonna steal fop, that's really useful. Thanks for posting these!
When it comes to command typos, you can configure `help.autocorrect` to use a suggested command automatically. You would have to set a timer, so with `git config --global help.autocorrect 20` it will enable auto-correct and suggested commands will run after 2 seconds (1 would be 100ms). So if you want your command mistakes to still work without having to create a bunch of aliases, this is a nice way to do it.
What about "git lsc" as an alias for "git status"?
("lsc" for "list changes")
I use fap : fetch --all --prune 😂
I almost never comment on videos, but I have to do so here. Your content, production quality, edit, and voice-over are brilliant. You should really make more videos.
Thank you so much for the nice comment! New video coming later today! :)
Couldn't agree more. The topics covered so far may be basic, but super useful. @philomatics please keep educating the masses
Just 2 videos and I learned a lot about git. I just started to use it and it's super helpful!
PS.: For every "Let me know in the comments if you'd like a full video..." I'm saying yes!
I use git stash all the time, especially when switching between branches for doing code reviews. I'll start working on a new feature on a feature branch, and if I need to fix a bug in my code review on another branch, I'll do a git stash, git checkout other branch, fix bug, git checkout feature branch, then a git stash pop
Yeah, git stash is super useful :)
Maybe try git worktree
This is really cool content, I've always wanted to do better in my git usage as a student so I don't bring any bad habits or practices into an actual collaborative project. I'm going to tell my friends to watch ur videos for tips and tricks!
A video about git amend?! Hell yes, git amend is surely one of my favorites.
good video as before. but the previous one was *fire*! because you took one single tip and explained it in great detail with animations and visualisation! THAT was the kill feature. the visualization!
one small animation can explain more than a 1000 words.
i know that it means more work and effort for you, but it works better for viewers than anything else.
thanks for the work!
looking forward for more :)
This is exactly the content someone getting into programming needs. Thanks so much for this!
If I need to force push something, I use the alias `lease = push --force-with-lease --force-if-includes` to have a very safe way to do it. In short, it will abort if there are any new changes in the remote, so it avoids deleting another person's pushed commits. It ensures that any updates from the remote have been incorporated locally by rejecting the forced update if that is not the case.
I used to only use `force-with-lease` and never needed `force-if-includes`, but since I'm using an alias either way, might as well use both.
This is a really nice one, thanks for sharing!
Idk why but I love these kind of videos. I watch them during lunch. Great job!
I’d also like to see more videos about useful linux commands/shortcuts.
Thanks for the suggestion! I'll consider it!
And thanks for the kind words :) Keeps me wanting to make more :)
OK. You have my subscription. I've been using Git for many years and you just made me feel like a newbie. I might make this required viewing for my team.
Wow, that's super nice to hear, thank you!
Great videos. In my opinion beginners struggle the most with reverting changes and with merges. In my opinion one of the most beneficial aliases is to do some graphical branch visualization like „git log --graph --decorate --oneline“ and similar. I see a lot of colleagues using extensions, tools like SourceTree or gitk or representations in Gitlab to display that, but then you always have to switch tools. In my opinion it is great that you can get the same in git-terminal.
Thanks for the kind words and the suggestions!
Hmm, I do think that the CLI representation of the branching structure is a bit difficult to interpret, especially for beginners. I myself prefer using GUIs.
If you put the gui in your path I think the tool switching isn't too bad - I use 'stree .' all the time to launch SourceTree from the current repo.
@@philomatics If you are in vscode then I know that "Git Graph" as an extension is quite popular here and for the merges BeyondCompare.
Since you are using those aliases in the command line, you can even register them in it's configuration (.bashrc etc).
Inside corresponding configuration file:
alias gcm='git commit -m'
alias gs='git status'
alias s='git status'
It's a preference thing, but by doing so, `git st` will become `gs` or even `s`.
By the way, loving your vids, keep it up!
That's cool! I personally prefer keeping each tool separate, but if you like this, it definitely works!
Thanks for grate and clear explanation and thanks more for covering this important and useful concepts.
Continue doing your great job, maan
He is but you didn't have to say it like a sheep!
the best new yt find, love the vids!
That's a really well produced video! Thanks!
Just found your channel. And started watching this new video that you added few minutes ago :)
another banger video! are these coming regulary now?
Thanks for the kind words!
Yep! Original plan was to release one every Monday but these take 30+ hours to create. So let's see how long I can keep it up or at what frequency I'm going to arrive at ;)
Great content, I would love to see you make more on git and other development tools.
Cool two videos on your channel, I like 7min duration
Thanks for explaining, very clever approaching to the point. Keep it up!
omg this video is a gem 💎💎💎💎💎💎💎
for me i use *PowerShell* aliases :
gco branchName -> git chechout branchName
gsw branchName -> git switch branchName
gsta -> git status
gst -> git status -s
gbr -> git branch
how to do it:
1- open PowerShell
2- run -> vim $PROFILE (it opens powershell profile file for configuratoin in vim)
(if you are not using vim : run -> echo $PROFILE ,this will print the path of the file and open it with any text editor)
3 - past this :
function gco($branchName) { git checkout $branchName }
function gsw($branchName) { git switch $branchName }
function gsta { git status }
function gst { git status -s }
function gbr { git branch }
Thanks for the nice comment and the tips for PowerShell, super helpful for Windows users!
Very useful video. Thank you. Keep up the good work.
The two alises I use the most:
fetcho = fetch origin master:master [pulls remote master changes into local master while being on feature branch, usually followed by a merge]
pulls = !git stash && git pull && git stash pop [when local changes prevent a pull]
Thanks for sharing!
Hah, fetcho is fun to say ;)
For `pulls` google the autostash setting, I think it might be super useful for you!
@@philomatics Didn't know that one, thanks :)
nice vid again, keep them coming!
4:58 You can use "git reset --hard HEAD" to reset all the files including the staged ones
Really good. Subscribed
Merge, rebase, squash maybe? I always have a hard time wrapping my head around them.
Thanks! Got stuff in the works on that!
A detailed git stash video would be nice
best git content on the www
We use a lot of submodules for shared libraries, so I use git subs = submodule update --init --recursive
I got that one too! Didn't wanna include it in the video because it would've been too long to explain, but I might do one on submodules at some point.
Thank you again, based Phil
Could please you tell me which tool you use for your animations🙏?
In this video it's just video editing software (Camtasia). In my first one it was Motion Canvas.
@@philomatics Thank you so much! You're doing a great job by the way👍✌️
Cool content
Where did you edit your video?
Excellent edit also
Edited in Camtasia :) Thanks for the super nice comment, made my day :)
You can restore a file deleted with 'git clean'. When using VSCode, create an empty file with the same name, then select this file in the Explorer, and click the 'Timeline' tab at the bottom left to see all changes for this file.
Cool tip, thanks for sharing!
Actually, you can use git reset --hard HEAD implement both git reset HEAD and git checkout
What's the difference between git checkout . with reset and git reset --hard?
No difference, does the same thing :)
def would like to learn more about amending commits
ty for letting me know!
I'd love a video about fixing merge errors. I do it constantly at work but it's always difficult. There's got to be some trick I don't know. I use VS code as my editor and it surely has a good process for this that I just never learned.
I'm working on this exactly! What kinds of problems do you run into when you merge?
@@philomatics my man! Watching it now!
I really like your videos!!
Great videos, keep it up
Thanks for you videos
Very useful. Thanks
i like to know about git stash in a future video
I would love to see a video about fixing git errors, I got this error and have never been able to fix it. “warning: Pulling without specifying how to reconcile divergent branches is
discouraged. You can squelch this message by running one of the following
commands sometime before your next pull:
git config pull.rebase false # merge (the default strategy)
git config pull.rebase true # rebase
git config pull.ff only # fast-forward only
You can replace "git config" with "git config --global" to set a default
preference for all repositories. You can also pass --rebase, --no-rebase,
or --ff-only on the command line to override the configured default per
invocation.”
I had made commits to the same branch on different computers I was able to push one to the origin but the. On the other computer I tried to do a pull and got the error above. I tried the 3 suggestions and was not able to get them to work. The only way I got back to a working state was deleting the repo on the second computer and recloning it back down.
Thanks for the suggestion! Might do a video on that in the future :)
Not sure what happened there in the repo, but I'd suggest running `git config --global pull.rebase false`.
This will set the default pull strategy to 'merge', which was the default in git for a long time. Then refer to my other video to help you decide whether you want to use the default pull or pull --rebase in the future.
Let me know if that helps or if you have any follow-up questions :)
nice video, i never use amend, stash
I would love buying an course of yours
Just need to have a good video about correct workflow on GitHub and Git to manege big project with 2-3 people for exemple.
Thanks for the suggestion! Might do a video on branching structure soon so stay tuned!
You have an opportunity to make your videos more inclusive by having your examples include a main branch instead of master
Hey, thanks for your suggestion! I did use master at one point in the video, but only to show how sometimes people are confused because they're used to pushing to master, when now it's called main. But I'm totally onboard with you!
I'd like a video about stash
alias for git log (git l) and git log --all (git la) with own format:
l = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'
la = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)' --all
Oh that's pretty cool! Might steal that for a follow up video at some point, thanks for sharing!
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)%an %Creset' --abbrev-commit --date=relative
st = status -s -b
bc = branch --show-current
Your content is great, and your style is really nice and clean. Like and sub from me! Can't wait to see more videos.
git rebase -i
Thanks for the suggestion! Video on rebasing is in the works!
0:10 The keyboard was in fact not 10-keyless, it had the numpad in plain view. 0/0 fake channel never subscribe
Ah damn you're absolutely right! Should've filmed my own instead of using stock footage. Video ruined.