0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【超初心者向け】Githubに新しいブランチを作成しプッシュする

0
Posted at

お恥ずかしながら最近プログラミング経験半年ほどになったのにも関わらず、Github の既存リポジトリに新しくブランチを切って commit, push をする方法を毎回のように調べているのでまとめておきます。

自分のような状況の方はぜひご利用ください。

前提条件

・push 予定の Github のリポジトリはすでに作成済みである
・お使いのシェルに Github アカウントが紐づいている

作業

これはやらなくても良いのかもしれないがとりあえずやった

$ git init

お使いのリポジトリを反映させる

$ git remote add origin <お使いのリポジトリ>

ブランチを作成し、同時にそのブランチに移る

$ git checkout -b <新規に作るブランチ名>

心配だったら現在のブランチを確認

$ git branch

ファイルを追加

$ git add .

コミットする

$ git commit -m 'first commit'

プッシュする

$ git push --set-upstream origin <さっき作ったブランチ名>

end

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?