More Related Content
GitLab + Dokku で作る CI/CD 環境 PlayFramework 2.0 Javaと WebSocketでつくる リアルタイムMVC Webアプリケーション Virtuoso 7 Install Guide for Ubuntu 12.10 (64bit) WSL2+docker+JupyterとVS Codeリモート環境の構築 What's hot (20)
Wocker 秒速で WordPress 開発環境を構築する boot2docker の format-me の話 世界一簡単なGithub入門(githubは無料で使用する場合、全てのファイルが公開されていることにご注意ください) GitLabを16万8千光年ワープさせた話 GITLAB BIG UPGRADE PROJECT Walter ファミリーの紹介 at Shibuya.go#1 Yocto Project ハンズオン / 参加者用資料 Rancher command line interface Similar to いいこんぶGitマニュアル (20)
Google container builderと友だちになるまで [Intermediate 02] シェルの使い方 / Git, GitHub について Debianを用いたCortex-M3マイコン開発事例のご紹介 Version Control System Tutorial バージョン管理システムチュートリアル Yocto Project ハンズオン プレゼン用資料 Getting Started With Ore-Ore Swift Standard Library + いいこんぶGitマニュアル
- 11. Lesson5.1
ローカルリポジトリ
ローカルリポジトリとなるフォルダを作成。
$ mkdir test
Gitを作成するディレクトリを初期化します。
$ cd test/
$ git init
Initialized empty Git repository in /home/tahichi_ver2.0/test/.git/
READMEファイルを新規作成。
$ touch README
ローカルリポジトリにcommitを行います。
commit文(“”の中身)はどのような更新があったのか簡潔に書きます。
$ git add .
$ git commit -m "add README"
[master (root-commit) 5a124f3] add README
このメッセージが
0 files changed, 0 insertions(+), 0 deletions(-)
表示されたらOK
create mode 100644 README
- 22. push
リモートサーバへの反映
$ git push <remotename>
ローカルブランチと同名のブランチをリモート上に作成する
$ git push <remote> <localbranch>
別名でpushする
$ git push <remote> <localbranch>:<remotebranch>
リモートブランチを削除する
$ git push –delete <remote> <localbranch>:<remotebranch>
$ git push <remote> :<branchname>
プッシュしたリモートブランチをトラッキングする
$ git push –u <remote> <branchname>
強制的にプッシュ
$ git push –f <remote> <branchname>
- 24. clone
リポジトリのコピーを作成する
sshを利用する
$ git clone ssh://[user@]host[:port]/path/to/test.git
$ git clone [user@]host:path/to/test.git
httpsを利用
$ git clone http[s]://host[:port]/path/to/test.git/
ローカル
$ git clone [file://]/path/to/test.git/
- 26. branch
ローカルブランチを作成/削除する
ブランチの移動(名前変更)
$ git -m <oldbranch> <newbranch>
$ git -M <oldbranch> <newbranch>
トラッキング先を設定する
$ git branch --set-upstream <local_branch> <remote_branch>
これをするとgit push/pullのときにリモートブランチを指定しなくて
も、設定したブランチに対して実行してくれます。
- 27. checkout
ブランチを取得する
$ git checkout <branch>
ブランチを作成してチェックアウト
$ git checkout -b <newbranch> [<startpoint>]
リモートブランチのトラッキングブランチを作成しチェックアウト
$ git checkout –t <remote>/<branch>
コミット前の変更を取り消す
$ git checkout <path>…
- 29. merge
ブランチを取り込む
$ git merge <branch>
fast-forwardしない
$ git merge --no-ff <branch>
マージのログを一つに圧縮する
$ git merge --squash <branch>
*fast-forward
早送りという意味なのですが、branchを統合する際に