LoginSignup
1
0

More than 3 years have passed since last update.

安全にgitのorphan branchを作る

Last updated at Posted at 2019-09-17

tl; dr

新しくディレクトリを作って、そこに適当なファイルを置いて git init すると、新しいrepositoryができる。
そこでmasterに一度commitしたあとに、 git branch -m で実際に作りたいブランチ名に変更してからremoteを足してpushすると安全にorphan branchが作れる。

手順

mkdir SOME_DIR
cd SOME_DIR
# 適当に必要なファイルを配置・作成
git init
git add *
git commit -m 'initial'
git branch -m BRANCH_NAME
git remote add origin git@github.com:HOGE/MOKE.git
git push origin BRANCH_NAME

これで安心。

1
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
1
0