ラベル git の投稿を表示しています。 すべての投稿を表示
ラベル git の投稿を表示しています。 すべての投稿を表示

2014年11月24日月曜日

[github]fork元からcommitをマージする方法

メモ。
github上でforkしたリポジトリで動いているときにfork元に何らかのcommitがあった場合のmerge方法
git remote add upstream https://fork元のurl
git fetch upstream
こうすると新しくブランチが作成されるのでそれに対してmergeを行えば良い
作業ディレクトリに移動して以下のコマンドでmerge
git merge upstream/repository名
参考公式ページ
fork-a-repo
syncing-a-repo

2014年4月1日火曜日

[git] git 基本

最近svnの変わりにgitを使うようになったのでそのメモ

git status 
git branch -a -v : local branchやremote branch、最終コミットログが見れる
git checkout -b local_branch origin remote_name : remote_branchからlocal branchを作る
git checkout localfile : localbranch からlocalfileを復元する。 
git add localfile : 指定したファイルをstage状態にする(commit出来る状態にする)
git commit : stage状態にあるファイルをローカルブランチにcommitする(この状態ではremote branchにはcommitされない)
git push origin local branch:origin/remote branch : remote branchにcommitする。これをやると後戻りできない。
基本的な概念がsvnと違うので結構戸惑った。っていうか今も。