Placeholder Image

字幕表 動画を再生する

  • You're working away, you get distracted, you come back to your computer,

    作業中に他に気をとられ  その後コンピューターに戻ってみると

  • you forget where you were... the thing you need is Diff.

    何をしていたか忘れています そんな時にはDiff です

  • Git Hub & Git Foundations

    GitHub とGit の基礎

  • Diff

    Diff

  • Welcome to another episode of Git Hub Foundations.

    Git Hub の基礎 今回のエピソードは

  • I'm Tim Berglund and today we're going to look at the Diff command.

    ティム・バーグランドです 今日はDiff コマンドについてお話します

  • We're gonna take a look at three different ways to use it.

    3つの使い方について見てみましょう

  • Diff git diff

    Diff git diff

  • If you make one simple change and then commit it right away,

    ちょっと更新をして すぐにコミットをした場合

  • you're not gonna need Git to tell you what you've done.

    Git は必要ありません

  • You probably keep track of that in your head.

    頭の中で何をしたか 覚えているでしょう

  • But there are lots of times when you need to examine

    でも何を更新したか 調べてみたくなる時が

  • how content has changed. There are three main ways

    多々あるんです 主に3つの方法があります

  • to do this, all with one command: Diff.

    コマンドはひとつ:Diff

  • One of the great things about looking at Diff

    Diff のいいところは

  • is it helps solidify what we learned about the staging area

    ステージングについて学んだことを 固めることができます

  • when we were learning how to commit.

    コミットについて学習しましたよね

  • Now, suppose you change a file and then get called away

    例えばファイルを更新して コンピューターから

  • from you computer for a little bit and then come back,

    しばらく離れてまた戻ってきます

  • how are you gonna remember what you were doing?

    何をしていたかどうやって 思い出しますか?

  • To put that a different way, you wanna know what changes

    言葉を換えると ファイルに対して

  • you've made to your files that you haven't staged yet.

    まだステージングしていない時に どんな更新をしたか知ることです

  • This is also handy if you use development tools that automatically

    開発用のツールを使って 自動的に更新を行っている場合は

  • make changes to your code for you and you wanna find out what

    その更新内容を調べるのに とても便利です

  • those changes are. Just type git diff and you'll get a description of exactly

    git diff とタイプするだけで ステージングエリアから

  • how your working tree, that is, just your files,

    ワーキングツリー つまりファイルの

  • differs from your staging area.

    更新内容をすべて教えてくれます

  • [Diff --staged, HEAD]

    [Diff --staged, HEAD]

  • Now, suppose you'd already staged those files and you wanna know

    ファイルを既に ステージングしたとして

  • how the things in your staging area are different from the most recent commit

    ステージングエリアと最新の コミットとの差分を知りたいとします

  • in history. Just type git diff--staged, and you'll see those changes.

    git diff --staged とタイプすると その更新内容が表示されます

  • As a nice little bonus, going through this exercise

    おまけに この練習をすると

  • can really help solidify your understanding of how the staging area works.

    ステージングエリアの 理解が深まります

  • Just because you staged a file doesn't mean you can't change it again.

    ファイルをステージングしたからといって 更新できないわけではありません

  • If you go on making changes to that same file, the status command

    同じファイルを更新すると ステータスコマンドが

  • will tell you that the file is staged, and has unstaged changes

    ファイルはステージングされていて 同時に更新を取り下げると知らせます

  • at the same time. If you've done this, you might want the diff command

    この場合はdiff コマンドで

  • to skip over the staging area, and tell you about all the changes you've made

    ステージングエリアをスキップして ファイルのすべての更新内容を

  • to the file since your last commit. Typing git diff HEAD

    最後のコミット分から知りたくなります git diff HEAD とタイプすると

  • compares your working tree to the head commit

    作業中のツリーと head コミット、つまり

  • which is just another name for the most recent commit

    履歴の中の最新のコミットを比べます

  • in history. And once you start learning how to do things

    一度やり方が分かってくると

  • like branch and push and pull, this last pattern is gonna come in

    ブランチ、プッシュ、プル そして最後のパターンも

  • really handy. You can use it to compare two branches to one another,

    とても便利です 2つのブランチを比べたり

  • or maybe two prior commits in history

    履歴の中の2つのコミットを比べて

  • to get an idea of what changes took place in the past.

    過去にどんな更新があったのか 見ることが出来ます

  • [Diff --color-words, --word-diff]

    [Diff --color-words, --word-diff]

  • Now you might notice that that last Diff

    お気づきかもしれませんが さっきのDiff は

  • is reported in a way that's a little verbose.

    ちょっとくどい感じでした

  • I only changed one word, but Git is telling me

    ひとつ単語を変えたら Git ではあたかも1行全部が

  • I changed an entire line. This is literally how Git processes

    更新されように見えます これはGit のプロセスで

  • text file differences, but it's not necessarily helpful to look at.

    テキストファイルの差分を出しています でもそれでは便利じゃないかも

  • You can add the --color-words or --word-diff switch

    --color-words または --word-diff スイッチを追加すると

  • to any Diff command to get it to give you

    どのDiff コマンドでも 見やすいレポートを出して

  • an easier to read report of small changes to long lines.

    長い文章の中から 細かい差異を表示します

  • This can be a real life saver sometimes.

    これはとても助かるんです

  • Another handy trick is to get Diff to suppress all that patch output

    もうひとつ便利なのは Diff でパッチのアウトプットを

  • and just tell you about the files that have changed.

    まとめて、更新された ファイルについて表示します

  • Use the --stat switch for this. This is great when you've got

    --stat スイッチを使います これは複雑な比較を行うときに

  • a complex diff but you might just need to zero in

    更新されたファイルのみに 的をしぼる事ができます

  • on one particular file that's changed.

    Git は更新のトラッキングを しているんです

  • Tracking changes is what Git does. The Diff command is your window

    Diff コマンドは作業の窓口で Git はそれを記録しています

  • into the work you've done and how Git sees the changes.

    これは便利なコマンドですよね

  • It's a great command to know.

    ありがとうございました

  • [Thanks for watching]

    GitHubの基礎 今回のエピソードをご覧いただき

  • Thanks for watching this episode of Git Hub Foundations

    ありがとうございました GitHub ガイドもどうぞご覧ください

  • on the Diff command. Subscribe to Git Hub Guides here,

    いつものように 質問やコメントをお待ちしています

  • and as always, please leave us a question or a comment,

    下記に書き込んで下さい 他のトレーニングビデオは

  • anything like that down below, and if you wanna see more training videos,

    下をご覧ください

  • check out these guys you see down here.

    ありがとう!

  • Thanks!

    ♪ (ジャズ) ♪

  • ♪ (jazz) ♪

You're working away, you get distracted, you come back to your computer,

作業中に他に気をとられ  その後コンピューターに戻ってみると

字幕と単語

ワンタップで英和辞典検索 単語をクリックすると、意味が表示されます