Git
We're managing our project source code by GitHub.
When you download/upload to GitHub, you need to use Git command.
Installation
For macOS
You can install Git command through Homebrew.
Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Git
After installing Homebrew.
brew install git
For Windows
You can install Git command through Scoop.
Scoop
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
# or shorter
iwr -useb get.scoop.sh | iex
Git
After installing Scoop.
scoop install git
Advanced
Git is able to make diff between target branches or commits. By using it, you can prepare the file list that was changed between branches or commits.
If you're using Zsh (Default shell of macOS), you can add the following function to your ~/.zshrc
file.
# Create diffrence files between current with specified commit
# git_diff ${commit_no}
function git_diff() {
git diff $1 --diff-filter=ACMR --name-only | sed -e 's/\(^.*$\)/"\1"/g' | xargs git archive --format=zip --prefix=_diff/ HEAD -o _diff.zip
}
If you're using Fish, you can add the following function to your ~/.config/fish/config.fish
file. (I haven't check this works properly yet, so if it's not working, please let me know)
# Create diffrence files between current with specified commit
# git_diff ${commit_no}
function git_diff
git diff $argv[1] --diff-filter=ACMR --name-only | sed -e 's/\(^.*$\)/"\1"/g' | xargs git archive --format=zip --prefix=_diff/ HEAD -o _diff.zip
end
After adding the function, you can use git_diff
command to create a zip file that contains the difference between the current branch and the specified commit.
git_diff ${commit_no}
# Example usage : compare with the latest commit
git_diff HEAD^