ç·æ¥æ°äººã¨ã³ã¸ãã¢å¿æ´ä¼ç»ï¼ ã¨ãããã¨ã§èªåã Git ã®ã¨ã¤ãªã¢ã¹ã¨ãã¦è¨å®ãã¦ãã便å©ã³ãã³ããç´¹ä»ãã¦ããã
ç´åã®ã³ãããã«è¿½ãã³ããããã (git fixit
)
git commit --amend --no-edit
ããããæ´ã㦠git push
ããããã¨ããã¨ããã£ã¡ãã£ã¨ä¿®æ£ããããã¨ãªãã®ã¯ãããããã¨ããã®éãã¡ãã¡ã³ãããã¡ãã»ã¼ã¸ãæ¸ã㦠rebase ãããã¨ããã¨ãããªé¢åã¯ã¨ããããªããä¸æã§çµãããããã--no-edit
ã§ã³ãããã¡ãã»ã¼ã¸ãç·¨éããã« --amend
ã§ããã
git fixit
ã«è¨å®ãã¦ãããgit commit
ã®å¼æ°ããã®ã¾ã¾åãä»ããã®ã§ãgit fixit -a
ã git fixit <file>
ã®ããã«ä½¿ããã
ã¡ã¤ã³ãã©ã³ãã«æ»ã (git com
)
f() { remote_head=$(git symbolic-ref --quiet refs/remotes/origin/HEAD); remote_head=${remote_head#refs/remotes/origin/}; git checkout ${remote_head:-$(git rev-parse --symbolic --verify --quiet main || git rev-parse --symbolic --verify --quiet master)}; }; f
æè¿ã 㨠mainãã¾ã㯠master ãã©ã³ãã«æ»ããä½æ¥ãä¸æ¦å®äºããã¨ãã¨ããã¡ã¤ã³ãã©ã³ããé²ãã§ãã®ã§ pull ãã¦ããããã¨ãã¨ãã«ä½¿ããf()
ãå®ç¾©ãã¦ããå¼ã³åºãã¦ãã®ã¯ãã¨ã¤ãªã¢ã¹ããã·ã§ã«å¼ã³åºãã使ãéã«å¼æ°ãã¨ããããã«ããããã®ã¤ãã£ãªã ã®ãããªãã®ãããã§ã¯ä½¿ã£ã¦ãªããã©ãã
git com
ã«ãã¦ããgit co
ã git checkout
ã«ãã¦ãã®ã§ã"git checkout main".
git config --global alias.com '!f() { ... }; f'
ã®ããã« !
ãä»ä¸ãã¦è¨å®ãã¦ãã ããã
æè¿ãã§ãã¯ã¢ã¦ããããã©ã³ããä¸è¦§ãã (git r
)
git reflog -n 50 --pretty='format:%gs' | perl -anal -e '$seen{$1}++ or print $1 if /checkout:.*to (.+)/'
git r
ã«ãã¦ããè¤æ°ã®ãã¨ãåæã«é²ãã¦ãã¨ãã©ã³ãåãæãåºããªãã®ã§ããããã®ã§ããã²ã¼ã·ã§ã³ããã-n 50
ã®ã¨ãã㯠--since '1 weeks ago'
ãªã©ã¨ãã¦ãããã¨æããèªåã®ãªãºã ã§ã
ãã©ã³ãããã¡ã¤ã«ã github.com ã§é²è¦§ãã (git o
)
git browse-remote
git-browse-remote ã§ããã©ã³ãããã¡ã¤ã«ããã©ã¦ã¶ã§éããã URL ãæ¨æºåºåã«åãåºãããããã
git o
ã«ãã¦ã¾ããæè¿ã¯ gh ã§ãã£ã¨ä¾¿å©ã«ãªãã®ãããããªããã¾ã 移è¡ããçç±ããªããgit pr
㧠git browse-remote --pr
ãå¼ã³åºãããã«ãªã¯ã¨ã¹ããéããããã«ãã¦ããã
ã³ãããã® SHA-1 ãå¾ã (git sha
)
f() { git rev-parse "${1-HEAD}"; }; f
git sha
ã«ãã¦ã¾ãããã¾ï½ã«ä½¿ããããã¯å¼æ°ã¨ãããã¿ã¼ã³ã