Lin映如
    • 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
    • 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 Versions and GitHub Sync Note Insights 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
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- title: Git(Gitlab簡介+常用指令) tags: 暑假 --- Git(Gitlab簡介+常用指令) === ## Gitlab介紹 ### 簡介 GitLab是利用Ruby on Rails一個開源的版本管理系統 - 實現一個自託管的Git專案倉庫,可通過Web介面進行訪問公開的或者私人專案。 - 可以管理團隊對倉庫的訪問,它非常易於瀏覽提交過的版本並提供一個檔案歷史庫。 - 團隊成員可以利用內建的簡單聊天程式(Wall)進行交流。 - 它還提供一個程式碼片段收集功能可以輕鬆實現程式碼複用,便於日後有需要的時候進行查詢。 ### 爲什麼要使用GitLab? GitLab是集中服務器上管理git存儲庫的一個好方法。 GitLab讓您可以完全控制您的存儲庫或項目,並允許您自己決定是公共還是私有。 ### Gitlab的服務構成 - Nginx:靜態web伺服器。 - gitlab-shell:用於處理Git命令和修改authorized keys列表。 - gitlab-workhorse: 輕量級的反向代理伺服器。 - logrotate:日誌檔案管理工具。 - postgresql:資料庫。 - redis:快取資料庫。 - sidekiq:用於在後臺執行佇列任務(非同步執行)。 - unicorn:An HTTP server for Rack applications,GitLab Rails應用是託管在這個伺服器上面的。 ### 特徵 - GitLab免費託管您的(私人)軟件項目。 - GitLab是管理Git存儲庫的平臺。 - GitLab提供免費的公共和私人存儲庫,問題跟蹤和維基。 - GitLab是Git之上的一個用戶友好的Web界面層,它提高了使用Git的速度。 - GitLab提供了自己的持續集成(CI)系統來管理項目,並提供用戶界面以及GitLab的其他功能。 ### 優點 - GitLab提供了GitLab Community Edition版本,供用戶在他們的代碼所在的服務器上進行定位。 - GitLab免費提供無限數量的私人和公共存儲庫。 - 程式碼片段可以共享項目中的少量程式碼,而不是共享整個項目。 ### 缺點 - 在推拉(push/pull)倉庫時,它並不像GitHub那麼快。 - 從一個頁面切換到另一個頁面時,GitLab界面需要時間。 ### [GitLab安裝](https://www.1ju.org/gitlab/gitlab-installation) ---- ## 常用指令 我想先打上我實作上學習到常用到的 - git init 建立新的本地端 Repository。 - git clone [Repository URL] 複製遠端的 Repository 檔案到本地端。 - git status 檢查本地端檔案異動狀態 >可以確認有無成功push或是衝突解決等等.. - git add [檔案或資料夾] 將指定的檔案(或資料夾)加入版本控制。用 git add . 可加入全部 >把檔案交給 Git ,讓 Git 開始「追蹤」目錄,此時內容加到暫存區 - git commit 提交(commit)目前的異動。 >將暫存區的內容提交到儲存庫(Repository)保留,代表檔案能夠完整永久保存。 >我透作實作發現到在我們執行 git commit 指令時,先前都會先執行一次 **git add** 指令。這是因為「**git commit 只會處理暫存區裡的內容**」,也就是說如果今天新增檔案或是更改什麼動作,沒有先使用 **git add** 指令把檔案提交到**暫存區**,那麼 **git commit 指令就不會有所內容可以執行動作。** :::warning **補充**|覺得每次提交都要經過 git add 在使用 git commit 覺得很麻煩怎麼辦? git commit 裡可以搭配使用 -a 參數,如此一來就即使沒有先使用 add 也能完成 Commit 的動作囉! `$ git commit -a -m 'added new benchmarks'` 但是要**注意**這種方式,只能用於**已經存在於儲存區 (Respository)裡的檔案有效**,也就是已經有在儲存區但有重新更新的檔案,對於新加入的檔案(Untracked file)是無法執行的 ::: - git commit -m "修改記錄" 引號裡面代表註解,告訴我們這一次 Git 做了什麼更新、新增什麼到本地端。 - git log 查看先前的 commit 記錄。 - git push 將本地端 Repository 的 commit 發佈到遠端。 - git checkout 用於切換分支或恢復工作樹文件 >在實作上我透過切換分支再解決衝突問題 --- - git push origin [BRANCH_NAME] 發佈至遠端指定的分支(Branch) - git branch 查看分支。 - git branch [BRANCH_NAME] 建立分支。 - git checkout [BRANCH_NAME] 取出指定的分支。 - git checkout -b [BRANCH_NAME] 建立並跳到該分支。 - git branch -D [BRANCH_NAME] 強制刪除指定分支(須先切換至其他分支再做刪除)。 - git reset --hard [HASH] 強制恢復到指定的 commit(透過 Hash 值)。 - git branch -m <OLD_BRANCH_NAME> <NEW_BRANCH_NAME> 修改分支名稱。 #### 這裡基本看完後就可以來實際練習看看[下一篇Git實際練習(Gitlab)](https://hackmd.io/@mMibszW4TNyvPRQXo1dJYQ/Bkl7EGBxs) ---- ### 學習參考網頁 :::info [常用指令](https://hellojs-tw.github.io/git-101/cheat-sheet.html) []() []() :::

    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