Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
演習:Gitの操作(基本編) / GitHub Practice Basic
Search
kaityo256
PRO
October 17, 2022
Education
3.2k
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
演習:Gitの操作(基本編) / GitHub Practice Basic
物理情報工学ソフトウェア開発演習
kaityo256
PRO
October 17, 2022
More Decks by kaityo256
See All by kaityo256
What is XAI?
kaityo256
PRO
0
130
勾配ブースティングと決定木の話 / gradient boosting and decision trees
kaityo256
PRO
7
1.7k
GNU Makeの使い方 / How to use GNU Make
kaityo256
PRO
16
6k
この講義について / 00-setup
kaityo256
PRO
2
480
GitHubによるWebアプリケーションのデプロイ / 07-github-deploy
kaityo256
PRO
2
390
演習:Gitの基本操作 / 04-git-basic
kaityo256
PRO
1
610
演習:Gitの応用操作 / 05-git-advanced
kaityo256
PRO
1
360
演習:GitHubの基本操作 / 06-github-basic
kaityo256
PRO
1
440
バージョン管理とは / 01-a-vcs
kaityo256
PRO
2
430
Other Decks in Education
See All in Education
Beyond the Prompt: Programming as a Pathway to Statistical Thinking
minecr
0
310
NDIAS Automotive / IoT CTF 2026 Recap - Keyfob & OSINT
himitu23
0
280
Case Studies - Lecture 12 - Information Visualisation (4019538FNR)
signer
PRO
0
210
2026年度春学期 統計学 第6回 データの関係を知る(1)ー 相関関係 (2026. 5. 14)
akiraasano
PRO
0
200
SFプロトタイピング体験(滝中学校)
yusk1450
PRO
0
110
生成AI時代のエンジニア育成について考えてみた
akasan
0
200
0506
cbtlibrary
0
240
AI-Based Speaking Assessment of a Short-Term Study Abroad Program
uranoken
0
410
0513
cbtlibrary
0
250
0526
cbtlibrary
0
210
Lectura 1 (PIT : Python Basico)
robintux
0
980
プロポーザルを書く技術とアンチパターン/proposal-writing-and-antipatterns
moriyuya
13
3.7k
Featured
See All Featured
New Earth Scene 8
popppiees
3
2.5k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.5k
Google's AI Overviews - The New Search
badams
0
1.1k
Embracing the Ebb and Flow
colly
88
5.1k
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
170
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
How to train your dragon (web standard)
notwaldorf
97
6.7k
How to Talk to Developers About Accessibility
jct
2
490
Six Lessons from altMBA
skipperchong
29
4.4k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
210
Transcript
1 30 演習:Gitの操作(基本編) 慶應義塾大学理工学部物理情報工学科 渡辺 物理情報工学ソフトウェア開発演習
2 30 • Gitの初期設定を行う • コマンドラインでGitの操作を一通り確認する • VSCodeからもGitの操作ができることを確認する
3 30 1. 検索ボックスにgit bashと入力 2. 表示された「Git Bash」をクリック
4 30 Git Bashを開くと、以下のような画面となる $マークの右にカーソルが点滅しており、コマンド入力待ちになる このマークをコマンドプロンプト(もしくは単にプロンプト)と呼ぶ
5 30 Git Bashは、デフォルトでカレントディレクトリとカレントブランチを 表示する Git Bashを開いた直後は「ホームディレクトリ」がカレントディレクトリに なっている (PC室の環境では/z/になっているはず) 「cd
github」コマンドにより、カレントディレクトリをgithubに移動すると 右の表示が変わる(/z/githubになるはず)
6 30 Git Bashは、カレントディレクトリがGitリポジトリでない場合は カレントディレクトリしか表示しない カレントディレクトリがGitリポジトリの場合は、カレントブランチを表示する プロンプト表示により「カレントディレクトリ」と「カレントブランチ」を 常に確認すること
7 30 初期設定 git config --global user.name "ユーザー名" git config
--global user.email "メールアドレス“ git config --global core.editor vim git config --global core.autocrlf false git config --global init.defaultBranch main git config --global alias.st "status -s" ホームディレクトリ .gitconfig 上記設定は、ホームディレクトリ直下の .gticonfigに書き込まれる Gitに名前やアドレス、その他設定を伝える
8 30 cd mkdir git cd git ディレクトリの作成 git ホームディレクトリに移動してから
gitディレクトリを作成し、そこへ移動 カレント ディレクトリ mkdir test cd test さらにtestディレクトリを作成して そこへ移動 git test
9 30 1. 検索ボックスにvs codeと入力 2. 表示された「Visual Studio Code」をクリック
10 30 初回起動時の「日本語化パッケージをインストールして再起動」という 表示が出たら、クリックしてインストールする フォルダの開き方 「ファイル」から「フォルダーを開く」を選択 「このフォルダー内のファイルの作成者を 信頼しますか?」という表示が出たら 「はい、作成者を信頼します」を選ぶ
11 30 PCをクリック
12 30 ネットワークの場所(Z:)をクリック
13 30 「git」をダブルクリック
14 30 「test」をシングルクリック 「test」が選択された状態で「フォルダーの選択」をクリック
15 30 README.mdファイルの作成 git test README.md
16 30 1 2 1. ファイルの新規作成ボタンを押して 2. 「README.md」と入力
17 30 ファイル内容を入力したら保存すること ファイル名のタブの隣のアイコンが「•」だと未保存 ファイル名のタブの隣のアイコンが「X」だと保存済み Ctrl+S もしくは 「ファイル」の 「保存」をクリック
18 30 リポジトリの初期化 git init git test README.md .git .gitディレクトリが作られ、
testがgit管理下に入る
19 30 インデックスへの追加 git add README.md README.md README.md ワーキングツリー インデックス
リポジトリ ワーキングツリーからインデックスにファイルをコピー
20 30 コミット git commit -m "initial commit" README.md README.md
ワーキングツリー インデックス リポジトリ README.md インデックスの状態をそのまま「歴史」としてリポジトリに保存
21 30 README.md README.md ワーキングツリー インデックス リポジトリ README.md ファイルの修正 ワーキングツリーが、インデックス、リポジトリと異なる状態になる
22 30 README.md README.md ワーキングツリー インデックス リポジトリ README.md インデックスへの追加 git
add README.md ワーキングツリーからインデックスにファイルをコピー
23 30 コミット git commit -m "adds new line" インデックスの状態をそのまま「歴史」としてリポジトリに保存
README.md README.md ワーキングツリー インデックス リポジトリ README.md
24 30 ファイルの修正 ワーキングツリーが、インデックス、リポジトリと異なる状態になる README.md README.md ワーキングツリー インデックス リポジトリ README.md
25 30 コミット(自動ステージング) git commit -am "modifies README.md" README.md README.md
ワーキングツリー インデックス リポジトリ README.md commit -a オプションにより、修正のあるファイル全てを 自動でステージングしてからコミットする (ステージングを飛ばしているわけではない)
26 30 歴史の確認 git log git log --oneline main HEAD
initial commit adds new line modifies README.md ターミナルに表示された情報から 「玉と線」を頭の中に再構成すること
27 30 VSCodeからのコミット git add README.md この「+」ボタンがgit addに対応 1 2
28 30 git commit –m ”commit from VSCode” コミットボタン ここにコミットメッセージが
書ける
29 30 もしコミットメッセージを書き忘れてコミットボタンを押したら COMMIT_EDITMSGというファイルが開く 一番上に「commit from VSCode」と入力する 保存してからファイルを閉じる
30 30 main HEAD initial commit adds new line modifies
README.md commit from VSCode 歴史の確認 git log --oneline