Git 新手上路 AMA 實作練習腳本
- Windows
- Mac
- Git
- SourceTree
- 若使用 Brew 的話,可以用
brew install 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
每位 Git 新手上路都必須事先設定的兩行命令,設定你在版控時要顯示的 Name 與 Email 欄位。
git config --global user.name 你的姓名
git config --global user.email 你的電子郵件地址
git init
git add .
git commit -m "Initial commit"
git log
建立分支
git branch develop
建立分支並切換至新分支
git checkout -b develop
顯示所有分支
git branch
切換分支
git checkout develop
git tag v1.0
git tag -a v1.0
git remote add origin https://github.com/doggy8088/gitdemo.git
git push -u origin master
git push
git pull