LoginSignup
1
0

More than 3 years have passed since last update.

【備忘録】よく使うGitのコマンドとウェブサイト

Last updated at Posted at 2019-05-30

GitHubで自分が今現在よく使っているサイトやコマンドをざっくりとまとめたものです。コードのそれぞれの意味はご自身でお調べになるかして下さい。お手数をお掛け致しますが、何卒宜しくお願い致します。

Masterにファイルを追加

qiita.rb
Gitリポジトリ―の新規作成
$git init

ステージングエリアに追加
$git add ファイル名
$git add .

git addの取り消し
$git reset HEAD 
$git reset HEAD ファイル名

$git commit -m "コメント名"

直前のコミットを取り消す
$git commit --amend

全体の変更を確認する
$git status 

リポジトリ―一覧を表示する
$git remote -v

リポジトリ―を登録
$git remote add origin リポジトリ―名

リポジトリ―にpushにする
$git push origin master

git パスワード を毎回聞かれる問題の解決方法
https://qiita.com/rorensu2236/items/df7d4c2cf621eeddd468

forkしたリポジトリを更新する方法

qiita.rb
$git remote add upstream 本家リポジトリー
$git fetch upstream
$git merge upstream/master
$git push origin master

forkしたリポジトリを更新する方法
https://qiita.com/taoki11111/items/6582dafeb971f66d1f79

GitHubのリポジトリを別のOwnerに引き渡す
https://qiita.com/do7be/items/fa845240bc58b2153a44

ブランチの切り替え

ローカルブランチを確認
$git branch

ブランチの作成
$git branch ブランチ名

ブランチの切り替え
$git checkout ブランチ名

ブランチの削除
$git branch --delete ブランチ名
$git branch -D ブランチ名

変更点を一旦退避させる
$git stash 

cloneのやり方

$cd [ディレクトリー先]
$git init
$git clone [リポジトリ―名]

ファイルの削除

ファイルを消したい時
$git rm  ファイル名

フォルダごと消したいとき
$git rm -r フォルダ名

ファイルを管理対象から除外する(ファイルを残したい時)
$git rm --cached ファイル名

【Git】git clone コマンドで「fatal: Could not read from remote repository.」が表示された場合の対処方法
https://go-journey.club/archives/7344

参考文献等

あまり詳しくない人はこちらを購入してやれば基本的な所は身に着けられると思います。
GitHub実践入門
もう怖くないGit!チーム開発で必要なGitを完全マスター
https://www.udemy.com/share/1004bOBEYSd1dXRng=/

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