LoginSignup
0
0

More than 1 year has passed since last update.

gitコマンド

Posted at

コマンド忘れて毎回調べてるので箇条書きでまとめました。

よく使うコマンド


git init //既存のディレクトリをgitに登録
git remote add origin [リモートリポジトリのURL] //リモートリポジトリを追加
git remote -v //現在のリモートリポジトリを確認
git add . 
git commit -m "first commit"
git branch -M main
git checkout -b main
git push -u origin master //push
git push --set-upstream origin main //初期commitの時は上流ブランチがないとかでエラーがでるのでこっちを使うといいかも

git log
git reset --soft HEAD^ //commitを取り消せる
git reset --hard HEAD //
git update-ref -d HEAD //first commit だけは上記のresetで消せないのでこのコマンドを使う

Git Large File Storage

ファイルサイズが100 MBを超えるとgithubに上げられなくなるので以下を利用する必要がある。

https://git-lfs.github.com/
上記のサイトでダウンロードインストールを行った後以下のコマンド


git lfs install
 git lfs track "*.psd" //追加した拡張子をlfsで管理するようになる。lfsで管理されたものは100mbを超えてもよくなる。

以下参考

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