My most used git aliases

Поделиться
HTML-код
  • Опубликовано: 23 дек 2024

Комментарии • 95

  • @joshuagauss8179
    @joshuagauss8179 7 месяцев назад +40

    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

    • @philomatics
      @philomatics  7 месяцев назад +3

      Oh man I'm gonna steal fop, that's really useful. Thanks for posting these!

    • @vinicchleme
      @vinicchleme 7 месяцев назад +2

      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.

    • @oconsertador9021
      @oconsertador9021 6 месяцев назад

      What about "git lsc" as an alias for "git status"?
      ("lsc" for "list changes")

    • @0xshashwat
      @0xshashwat 4 месяца назад

      I use fap : fetch --all --prune 😂

  • @suparno2
    @suparno2 7 месяцев назад +23

    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.

    • @philomatics
      @philomatics  7 месяцев назад

      Thank you so much for the nice comment! New video coming later today! :)

    • @CoronaWolle
      @CoronaWolle 6 месяцев назад

      Couldn't agree more. The topics covered so far may be basic, but super useful. @philomatics please keep educating the masses

  • @AndyP3r3z
    @AndyP3r3z 7 месяцев назад +6

    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!

  • @7empestx
    @7empestx 7 месяцев назад +21

    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

    • @philomatics
      @philomatics  7 месяцев назад +3

      Yeah, git stash is super useful :)

    • @mrAjor
      @mrAjor 7 месяцев назад +3

      Maybe try git worktree

  • @ethanjoyner
    @ethanjoyner 7 месяцев назад +10

    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!

  • @ThienLe-po5nc
    @ThienLe-po5nc 7 месяцев назад +1

    A video about git amend?! Hell yes, git amend is surely one of my favorites.

  • @НазарПанасюк-у8я
    @НазарПанасюк-у8я 7 месяцев назад +1

    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 :)

  • @daehxxiD
    @daehxxiD 7 месяцев назад

    This is exactly the content someone getting into programming needs. Thanks so much for this!

  • @vinicchleme
    @vinicchleme 7 месяцев назад +1

    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.

    • @philomatics
      @philomatics  7 месяцев назад +1

      This is a really nice one, thanks for sharing!

  • @hazh9936
    @hazh9936 6 месяцев назад

    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.

    • @philomatics
      @philomatics  6 месяцев назад

      Thanks for the suggestion! I'll consider it!

    • @philomatics
      @philomatics  6 месяцев назад

      And thanks for the kind words :) Keeps me wanting to make more :)

  • @wingflanagan
    @wingflanagan 7 месяцев назад

    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.

    • @philomatics
      @philomatics  7 месяцев назад +1

      Wow, that's super nice to hear, thank you!

  • @peter_hauer
    @peter_hauer 7 месяцев назад +1

    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.

    • @philomatics
      @philomatics  7 месяцев назад

      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.

    • @peter_hauer
      @peter_hauer 7 месяцев назад

      @@philomatics If you are in vscode then I know that "Git Graph" as an extension is quite popular here and for the merges BeyondCompare.

  • @AleksandarV_
    @AleksandarV_ 7 месяцев назад

    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!

    • @philomatics
      @philomatics  7 месяцев назад +4

      That's cool! I personally prefer keeping each tool separate, but if you like this, it definitely works!

  • @amirhossein.banaei
    @amirhossein.banaei 2 месяца назад

    Thanks for grate and clear explanation and thanks more for covering this important and useful concepts.

  • @kirillzlobin7135
    @kirillzlobin7135 7 месяцев назад +2

    Continue doing your great job, maan

    • @bobDotJS
      @bobDotJS 7 месяцев назад

      He is but you didn't have to say it like a sheep!

  • @Bsunders
    @Bsunders 7 месяцев назад +1

    the best new yt find, love the vids!

  • @oceannuclear
    @oceannuclear 7 месяцев назад

    That's a really well produced video! Thanks!

  • @kirillzlobin7135
    @kirillzlobin7135 7 месяцев назад

    Just found your channel. And started watching this new video that you added few minutes ago :)

  • @siricecream17
    @siricecream17 7 месяцев назад +2

    another banger video! are these coming regulary now?

    • @philomatics
      @philomatics  7 месяцев назад +1

      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 ;)

  • @williamcoarsey5222
    @williamcoarsey5222 7 месяцев назад

    Great content, I would love to see you make more on git and other development tools.

  • @w1atrak1ng
    @w1atrak1ng 7 месяцев назад

    Cool two videos on your channel, I like 7min duration

  • @girondavidfour
    @girondavidfour 7 месяцев назад

    Thanks for explaining, very clever approaching to the point. Keep it up!

  • @Undrios
    @Undrios 5 месяцев назад +2

    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 }

    • @philomatics
      @philomatics  5 месяцев назад +1

      Thanks for the nice comment and the tips for PowerShell, super helpful for Windows users!

  • @krissh_the_dev
    @krissh_the_dev 7 месяцев назад

    Very useful video. Thank you. Keep up the good work.

  • @ELStalky
    @ELStalky 4 месяца назад

    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]

    • @philomatics
      @philomatics  4 месяца назад +1

      Thanks for sharing!
      Hah, fetcho is fun to say ;)
      For `pulls` google the autostash setting, I think it might be super useful for you!

    • @ELStalky
      @ELStalky 4 месяца назад

      @@philomatics Didn't know that one, thanks :)

  • @rainymatch
    @rainymatch 7 месяцев назад

    nice vid again, keep them coming!

  • @alexandreduhaime8622
    @alexandreduhaime8622 7 месяцев назад

    4:58 You can use "git reset --hard HEAD" to reset all the files including the staged ones

  • @rafaelortega1376
    @rafaelortega1376 3 месяца назад

    Really good. Subscribed

  • @cccccc864
    @cccccc864 7 месяцев назад +2

    Merge, rebase, squash maybe? I always have a hard time wrapping my head around them.

    • @philomatics
      @philomatics  7 месяцев назад +3

      Thanks! Got stuff in the works on that!

  • @berk_karaal
    @berk_karaal 7 месяцев назад +1

    A detailed git stash video would be nice

  • @Z1ew-k1q
    @Z1ew-k1q 6 месяцев назад +1

    best git content on the www

  • @theoneandonlyskinnyb
    @theoneandonlyskinnyb 7 месяцев назад +1

    We use a lot of submodules for shared libraries, so I use git subs = submodule update --init --recursive

    • @philomatics
      @philomatics  7 месяцев назад +2

      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.

  • @jamesshockley4317
    @jamesshockley4317 7 месяцев назад

    Thank you again, based Phil

  • @mohammedaminelm7836
    @mohammedaminelm7836 7 месяцев назад +1

    Could please you tell me which tool you use for your animations🙏?

    • @philomatics
      @philomatics  7 месяцев назад +1

      In this video it's just video editing software (Camtasia). In my first one it was Motion Canvas.

    • @mohammedaminelm7836
      @mohammedaminelm7836 7 месяцев назад

      @@philomatics Thank you so much! You're doing a great job by the way👍✌️

  • @felipelealol
    @felipelealol 7 месяцев назад

    Cool content
    Where did you edit your video?
    Excellent edit also

    • @philomatics
      @philomatics  7 месяцев назад

      Edited in Camtasia :) Thanks for the super nice comment, made my day :)

  • @antonzimin3999
    @antonzimin3999 7 месяцев назад

    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.

    • @philomatics
      @philomatics  7 месяцев назад

      Cool tip, thanks for sharing!

  • @siuyutpang2335
    @siuyutpang2335 3 месяца назад +1

    Actually, you can use git reset --hard HEAD implement both git reset HEAD and git checkout

  • @danser_theplayer01
    @danser_theplayer01 2 месяца назад

    What's the difference between git checkout . with reset and git reset --hard?

    • @philomatics
      @philomatics  2 месяца назад

      No difference, does the same thing :)

  • @emnul8583
    @emnul8583 3 месяца назад

    def would like to learn more about amending commits

  • @bobDotJS
    @bobDotJS 7 месяцев назад

    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.

    • @philomatics
      @philomatics  7 месяцев назад +1

      I'm working on this exactly! What kinds of problems do you run into when you merge?

    • @bobDotJS
      @bobDotJS 7 месяцев назад

      ​@@philomatics my man! Watching it now!

  • @TheBrunoRM
    @TheBrunoRM 7 месяцев назад

    I really like your videos!!

  • @ExotErr
    @ExotErr 7 месяцев назад

    Great videos, keep it up

  • @dmitrytomashevich4344
    @dmitrytomashevich4344 7 месяцев назад

    Thanks for you videos

  • @shakirahsanromeo7863
    @shakirahsanromeo7863 7 месяцев назад

    Very useful. Thanks

  • @krateskim4169
    @krateskim4169 7 месяцев назад

    i like to know about git stash in a future video

  • @cpbpilot
    @cpbpilot 7 месяцев назад

    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.

    • @philomatics
      @philomatics  7 месяцев назад

      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 :)

  • @Lunolux
    @Lunolux 7 месяцев назад

    nice video, i never use amend, stash

  • @kauai9763
    @kauai9763 7 месяцев назад

    I would love buying an course of yours

  • @karlson2804
    @karlson2804 7 месяцев назад

    Just need to have a good video about correct workflow on GitHub and Git to manege big project with 2-3 people for exemple.

    • @philomatics
      @philomatics  7 месяцев назад

      Thanks for the suggestion! Might do a video on branching structure soon so stay tuned!

  • @yrtepgold
    @yrtepgold 6 месяцев назад

    You have an opportunity to make your videos more inclusive by having your examples include a main branch instead of master

    • @philomatics
      @philomatics  6 месяцев назад +1

      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!

  • @tfld
    @tfld 7 месяцев назад

    I'd like a video about stash

  • @carstenschlegel6975
    @carstenschlegel6975 7 месяцев назад

    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

    • @philomatics
      @philomatics  7 месяцев назад

      Oh that's pretty cool! Might steal that for a follow up video at some point, thanks for sharing!

  • @synapty
    @synapty 23 дня назад

    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

  • @atom8861
    @atom8861 7 месяцев назад

    Your content is great, and your style is really nice and clean. Like and sub from me! Can't wait to see more videos.

  • @asdfg_qwert
    @asdfg_qwert 7 месяцев назад

    git rebase -i

    • @philomatics
      @philomatics  7 месяцев назад

      Thanks for the suggestion! Video on rebasing is in the works!

  • @Excalibaard
    @Excalibaard 7 месяцев назад

    0:10 The keyboard was in fact not 10-keyless, it had the numpad in plain view. 0/0 fake channel never subscribe

    • @philomatics
      @philomatics  7 месяцев назад +1

      Ah damn you're absolutely right! Should've filmed my own instead of using stock footage. Video ruined.