Upgrade to Pro — share decks privately, control downloads, hide ads and more …

10 Git Command You Should Start Using Today

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

10 Git Command You Should Start Using Today

10 Git Command You Should Start Using Today @ Laravel Meetup Taipei 2025 #1

Avatar for mouson(墨嗓)

mouson(墨嗓)

April 19, 2025
Tweet

More Decks by mouson(墨嗓)

Other Decks in Programming

Transcript

  1. About Me • Mouson (陳佑 竹 ) • GitLab Hero

    • Senior System Analyst • GitLab Taipei User Group / DevOps Taiwan / Laravel Taiwan • [email protected] • https://gitlab.com/mo-playground • https://gitlab.com/mouson
  2. Restore speci fi ed paths in the working tree with

    some contents from a restore source. restore Ref: https://git-scm.com/docs/git-restore 01 02 03 04 05 06 07 08 09 10 v2.23
  3. Save your local modi fi cations to a new stash

    with messages stash push -m Ref: https://git-scm.com/docs/git-stash v2.13 01 02 03 04 05 06 07 08 09 10
  4. -r, --rebase-merges By default, a rebase will simply drop merge

    commits from the todo list, and put the rebased commits into a single, linear branch. With --rebase-merges, the rebase will instead try to preserve the branching structure within the commits that are to be rebased, by recreating the merge commits. rebase -r Ref: https://git-scm.com/docs/git-rebase 01 02 03 04 05 06 07 08 09 10
  5. rebase -r Ref: https://git-scm.com/docs/git-rebase 01 02 03 04 05 06

    07 08 09 10 A B C D E F G H I J git rebase D git rebase D -r
  6. rebase -r Ref: https://git-scm.com/docs/git-rebase 01 02 03 04 05 06

    07 08 09 10 A B C D E F G H I J git rebase D git rebase D -r A B C D E' F' G' H' I' J'
  7. rebase -r Ref: https://git-scm.com/docs/git-rebase 01 02 03 04 05 06

    07 08 09 10 A B C D E F G H I J git rebase D git rebase D -r A B C D E' F' G' H' I' J' A B C D E' F' G' H' I' J'
  8. Local GIT Rerere Sample I have a World!!! feature master

    I have a Apple !!! I have a Pen !!!
  9. Local GIT Rerere Sample I have a World!!! feature master

    I have a Apple !!! I have a Pen !!! I have a Apple Pen !!!
  10. GIT Rerere Demo 1. enable rerere feature git con fi

    g --global rerere.enabled true https://goo.gl/8wj1he
  11. Local GIT Rerere Sample I have a World!!! feature master

    I have a Apple !!! I have a Pen !!!
  12. Local GIT Rerere Sample I have a World!!! feature master

    I have a Apple !!! I have a Pen !!!
  13. Local GIT Rerere Sample I have a World!!! feature master

    I have a Apple !!! I have a Pen !!!
  14. Local GIT Rerere Sample I have a World!!! feature master

    I have a Apple !!! I have a Pen !!!
  15. Manage multiple working trees attached to the same repository. worktree

    https://git-scm.com/docs/git-worktree 01 02 03 04 05 06 07 08 09 10 v2.5
  16. Local GIT worktree Sample I have a World!!! feature master

    I have a Apple !!! I have a Pen !!! 01 02 03 04 05 06 07 08 09 10
  17. Reduce your working tree to a subset of tracked fi

    les. sparse-checkout 01 02 03 04 05 06 07 08 09 10 https://git-scm.com/docs/git-sparse-checkout
  18. Use binary search to fi nd the commit that introduced

    a bug bisect Ref: https://git-scm.com/docs/git-bisect v1.5 01 02 03 04 05 06 07 08 09 10
  19. ? ? ? ? ? ? ? HEAD Some feature

    was a failure after merge v2.3
  20. ? ? ? ? ? ? ? HEAD Some feature

    was a failure after merge v2.3 git bisect start HEAD v2.3
  21. Use git bisect search failure commit v2.3 ? ? ?

    ? ? ? ? HEAD git bisect start HEAD v2.3
  22. Use git bisect search failure commit v2.3 ? ? ?

    ? ? ? ? HEAD git bisect start HEAD v2.3
  23. Use git bisect search failure commit v2.3 ? ? ?

    ? ? ? ? HEAD BAD git bisect start HEAD v2.3
  24. Use git bisect search failure commit v2.3 ? ? ?

    ? ? ? ? HEAD BAD git bisect bad
  25. Use git bisect search failure commit v2.3 ? ? ?

    BAD ? ? ? HEAD git bisect bad
  26. Use git bisect search failure commit v2.3 ? ? ?

    BAD ? ? ? HEAD BAD BAD BAD git bisect bad
  27. Use git bisect search failure commit v2.3 ? ? ?

    BAD ? ? ? HEAD BAD BAD BAD GOOD
  28. Use git bisect search failure commit v2.3 ? ? ?

    BAD ? ? ? HEAD BAD BAD BAD GOOD git bisect good
  29. Use git bisect search failure commit v2.3 ? ? ?

    BAD ? ? ? HEAD BAD BAD BAD GOOD git bisect good
  30. Use git bisect search failure commit v2.3 ? ? ?

    BAD ? ? ? HEAD BAD BAD BAD GOOD GOOD git bisect good
  31. Use git bisect search failure commit v2.3 ? ? ?

    BAD ? ? ? HEAD BAD BAD BAD GOOD GOOD
  32. Use git bisect search failure commit v2.3 ? ? ?

    BAD ? ? ? HEAD BAD BAD BAD GOOD GOOD X
  33. use git blame fi nd detail v2.3 ? ? ?

    BAD ? ? ? HEAD BAD BAD BAD GOOD GOOD X
  34. Run tasks to optimize Git repository data gc, commit-graph, loose-objects...

    maintenance https://git-scm.com/docs/git-maintenance 01 02 03 04 05 06 07 08 09 10 v2.29