LoginSignup
3
4

More than 5 years have passed since last update.

GitHubでForkした際に使用するGitコマンド

Last updated at Posted at 2017-09-26

構成

repo.png

はじめに…

upstreamの設定

$ git remote add upstream https://github.com/ORIGINAL/REPOSITORY.git

設定の確認

$ git remote -v
origin    https://github.com/MY_USERNAME/REPOSITORY.git (fetch)
origin    https://github.com/MY_USERNAME/REPOSITORY.git (push)
upstream  https://github.com/ORIGINAL/REPOSITORY.git (fetch)
upstream  https://github.com/ORIGINAL/REPOSITORY.git (push)

ユーザーの設定

$ git config --local user.name MY_USERNAME
$ git config --local user.email MY_EMAIL_ADDRESS

定期的に…

upstreamとの同期

コミット(upstream → local)

$ git fetch upstream
$ git checkout master
$ git rebase upstream/master

コミット(local → origin)

$ git push origin master

タグ(local → origin)

$ git push --tags origin

削除されたブランチ(upstream → local)

$ git fetch --prune upstream

または

$ git remote prune upstream

削除されたブランチ(origin → local)

$ git fetch --prune origin

または

$ git remote prune origin
3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4