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 3 years have passed since last update.

Githubでリポジトリ作成したときに出てくるやつ(メモ)

Posted at

注意

記事として独創性は皆無。
リポジトリを作成したときにいつもコミットの仕方を忘れるので残しておきます。

ローカルで設定すること

コマンドラインからリポジトリを作成する場合:

echo "# [repo. name]" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/[username]/[repo.].git
git push -u origin main

既存のリポジトリをプッシュする場合:

git remote add origin https://github.com/[username]/[repo.].git
git branch -M main
git push -u origin main

久々に利用したらいつの間にかデフォルトのbranch名がmasterからmainに変わっていました。

最後に

gitちゃんと勉強しないと、後々めんどくさいことになります。
(少なくとも、rebaseやresetといったリモート先のコミット履歴を消すまでは反射的に体にしみこませないと。)

0
0
1

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?