李俊諭 JYUN-YU LI
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    2
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    --- title: Git自訂常用指令配置 tags: Git --- <style> .red{ color: red; } .orange{ color: #ff5733; } .blue{ color: #3383ff; } </style> # Git自訂常用指令配置 紀錄筆者常用指令簡化操作配置,不定期更新內容。 使用`git config`進行設置。 設置命令規格: git config <font class='red'>--global</font> <font class='orange'>alias</font>.<font class='orange'><自訂命令名稱></font> <font class='blue'> <command> </font> * <font class=red>--global</font> 代表全域通用,針對範圍限制在當前git目錄,可以改為<font class=red>--local</font>。 * 如果對應git命列有待入參數,需使用單引號將整個<font class='blue'> <command> </font>包覆起來。 ### 如何使用自訂指令 以[Git Log - 查看目前分支最後提交一筆commit紀錄](https://hackmd.io/Jwv3aYcgSnKJYfoWPdcyXg?view#%E6%9F%A5%E7%9C%8B%E7%9B%AE%E5%89%8D%E5%88%86%E6%94%AF%E6%9C%80%E5%BE%8C%E6%8F%90%E4%BA%A4%E4%B8%80%E7%AD%86commit%E7%B4%80%E9%8C%84---gt-git-last)為例,簡化指令名稱為`last`,完整指令下法如下 ```shell= git last ``` --- ## Git Log ### 美化所有Log輸出成一列,並帶入圖形軌跡 --> `git cma` ```shell= git config --global alias.cma 'log --pretty=oneline --graph --decorate --all' ``` * 原始指令 --> `git log --pretty=oneline --graph --decorate --all` * 簡化指令 --> `git cma` ### 查看目前分支最後提交一筆commit紀錄 --> `git last` ```shell= git config --global alias.last 'log -1 HEAD' ``` * 原始指令 --> `git log -1 HEAD` * 簡化指令 --> `git last` ## Git Commit ### Commit -m 新增一筆Commit ```shell= git config --global alias.com 'commit -m' ``` ## Git Cherry-Pick ### Cherry-Pick指令簡化 --> `git cp` ```shell= git config --global alias.cp 'cherry-pick' ``` * 原始指令 --> `git cherry-pick <CommitId>` * 簡化指令 --> `git cp <CommitId>` ### Cherry-Pick持續整合(解完衝突)指令簡化 --> `git cpc` ```shell= git config --global alias.cpc 'cherry-pick --continue' ``` * 原始指令 --> `git cherry-pick --continue` * 簡化指令 --> `git cpc` ### Cherry-Pick取消此次整合指令簡化 --> `git cpa` ```shell= git config --global alias.cpa 'cherry-pick --abort' ``` * 原始指令 --> `git cherry-pick --abort` * 簡化指令 --> `git cpa` ## Git Checkout ### Checkout指令簡化 --> `git ck` ```shell= git config --global alias.ck 'checkout' ``` * 原始指令 --> `git checkout <本地分支>` * 簡化指令 --> `git ck <本地分支>` ### 建立新分支指令簡化 --> `git cb` ```shell= git config --global alias.cb 'checkout -b' ``` * 原始指令 --> `git checkout -b <本地分支> <來源分支>` * 簡化指令 --> `git cb <本地分支> <來源分支>` ## Git Push ### 上傳新分支(遠端上還未有對應分支)指令簡化 --> `git puo` ```shell= git config --global alias.puo 'push -u origin' ``` * 原始指令 --> `git push -u origin <本地分支>` * 簡化版 --> `git puo <本地分支>` ## Git Merge ### Merge指令簡化 --> `git me` ```shell= git config --global alias.me 'merge' ``` * 原始指令 --> `git merge <來源分支>` ### Merge持續合併(解完衝突)指令簡化 --> `git mec` ```shell= git config --global alias.mec 'merge --continue' ``` * 原始指令 --> `git merge --continue` ### Merge取消此次整合指令簡化 --> `git mea` ```shell= git config --global alias.mea 'merge --abort' ``` * 原始指令 --> `git merge --abort` ## Git Stash ### Stash暫存列表資訊 --> `git stls` ```shell= git config --global alias.stls 'stash list' ``` * 原始指令 --> `git stash list` * 簡化指令 --> `git stls` ### Stash暫存儲存一筆 --> `git sts` ```shell= git config --global alias.sts 'stash save' ``` * 原始指令 --> `git stash save <暫存標題>` * 簡化指令 --> `git sts <暫存標題>` ### Stash暫存刪除一筆 --> `git std` ```shell= git config --global alias.std 'stash drop' ``` * 原始指令 --> `git stash drop` * 簡化指令 --> `git std <暫存編號>`

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully