Skip to content

Instantly share code, notes, and snippets.

@doggy8088
Created September 2, 2017 11:57
Show Gist options
  • Star 21 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save doggy8088/e39cfa2f28cd6da43fcf1689cee3f5ff to your computer and use it in GitHub Desktop.
Save doggy8088/e39cfa2f28cd6da43fcf1689cee3f5ff to your computer and use it in GitHub Desktop.
2017/9/2 FB 直播:Git 新手上路 AMA 實作練習腳本

Git 新手上路 AMA 實作練習腳本

1. 安裝 Git 工具

推薦安裝

使用 Chocolatey 安裝 (Windows)

  • 安裝 Chocolatey 工具
    @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
    
  • 在命令提示字元下執行安裝命令 (以系統管理員身分執行)
    choco install git tortoisegit sourcetree -y
    

2. 初始設定

每位 Git 新手上路都必須事先設定的兩行命令,設定你在版控時要顯示的 Name 與 Email 欄位。

git config --global user.name 你的姓名
git config --global user.email 你的電子郵件地址

3. 初始化儲存庫

git init

4. 建立版本

git add .
git commit -m "Initial commit"

5. 查看版本紀錄

git log

6. 建立分支

建立分支

git branch develop

建立分支並切換至新分支

git checkout -b develop

7. 切換分支

顯示所有分支

git branch

切換分支

git checkout develop

8. 建立標籤

git tag v1.0
git tag -a v1.0

9. 推送版本

git remote add origin https://github.com/doggy8088/gitdemo.git
git push -u origin master
git push

10. 拉取版本

git pull

相關連結

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment