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?

環境構築でGitとBacklogを使う流れ

Posted at

Gitのインストール

サイト → https://git-scm.com/
・インストーラーをダウンロードしてインストール

BacklogでGitリポジトリを作成する

・Backlogにログイン(管理者権限)
・対象プロジェクトの「プロジェクト設定」→「基本設定」で「Gitを使用する」にチェックを入れる
・左メニューに「Git」が表示されるのでクリック
・「リポジトリを追加する」→ 名前と説明を入力して作成
・作成後、リモートリポジトリのURLが表示される
「例:https://xxx.backlog.jp/git/プロジェクト名/リポジトリ名.git

ローカル環境でGitを設定する

・プロジェクトフォルダを作成してGit Bashを起動
 ※ctrl + E → ctrl + shift + N → 右クリックでGitBashを起動
・下記のコマンドを実行
 git init
 git remote add origin https://xxx.backlog.jp/git/プロジェクト名/リポジトリ名.git
・初回プシュ時にBacklogのユーザー名とパスワードを求められるため入力する

開発(コミット~プッシュ)

・ブランチを作成
 git checkout -b feature/機能名
・ファイル編集後にステージング&コミット
 git add .
 git commit -m "コメントを残す"
・リモートにプッシュ
 git push origin feature

Backlog上でプルリクエスト作成

・Backlogの「Git」メニューから対象ブランチを選択
・「プルリクエストを作成」→ レビュー依頼やマージ先を指定

補足

git init
→ ローカルディレクトリをGit管理下に置くために使用(初期化)

git clone <URL>
→ リモートリポジトリをローカルに複製

git add
→ 変更したファイルを「ステージング」に追加
 git add. = カレントディレクトリ以下のすべての変更を追加
 git add -A = すべての変更をステージング
 git add --all = -Aと同じ意味
 git add ファイル名 = 特定のファイルのみ追加
 git add '*.js' = 拡張子がjsのファイルをまとめて追加

git commit -m "メッセージ"
→ ステージングされた変更を履歴として保存する

git push origin ブランチ名
→ ローカルの変更をリモートに反映
 初回はgit push -u origin ブランチ名で「追跡設定」も可能

git pull
→ リモートの最新変更をローカルに取り込む
 git fetch + git mergeを一括で行う

 git branch
→ 現在のブランチを表示

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?