LoginSignup
0
0

More than 3 years have passed since last update.

gitコマンド - branch作ってプッシュする手順

Last updated at Posted at 2019-05-17

それするのに必要そうなコマンドと流れのメモ。クローンしてディレクトリ入った後のことです。

branch確認

git branch -a

ローカルbranch作成

git branch first_branch

branch移動

git checkout first_branch

※そしてソース編集

リモートbranch登録

git push origin first_branch

branchステータス確認

git status

branch編集内容確認

git diff

branchファイル追加

git add ファイル名
git commit
git push

おまけ - SSL証明書エラーを回避 (最初にやっとくもん笑)

git config --global http.sslVerify false

おまけ - git logを一つにまとめる

1.コメントのidを一覧表示
git log --oneline
56ff7fc first commit
3a4d26f test
8d238dd test
d31d913 test
d3ef00d test
5c735a5 test
f189291 test
44974c6 config file first commit
5cb3a02 add README

2.コメントをまとめる(最初は全部 pick なので 一番最初以外全部 s にして保存)
git rebase -i 5cb3a02 ←まとめたいコメントの開始のid
pick 44974c6 config file first commit
s f189291 test
s 5c735a5 test
s d3ef00d test
s d31d913 test
s 8d238dd test
s 3a4d26f test
s 56ff7fc first commit

------------------------------------
p, pick = use commit
r, reword = use commit, but edit the commit message
e, edit = use commit, but stop for amending
s, squash = use commit, but meld into previous commit
f, fixup = like "squash", but discard this commit's log message
x, exec = run command (the rest of the line) using shell
------------------------------------

editorが立ち上げるのでコメントを入れて保存

3.gitにプッシュする
git push -f
0
0
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
0
0