Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Suppose you're pulling to master. You can refer to the previous position of <code>master</code> by <code>master@{1}</code> (or even <code>master@{10.minutes.ago}</code>; see the specifying revisions section of the <a href="http://www.kernel.org/pub/software/scm/git/docs/git-rev-parse.html" rel="noreferrer">git-rev-parse man page</a>), so that you can do things like</p> <ul> <li><p>See all of the changes: <code>git diff master@{1} master</code></p></li> <li><p>See the changes to a given file: <code>git diff master@{1} master &lt;file&gt;</code></p></li> <li><p>See all the changes within a given directory: <code>git diff master@{1} master &lt;dir&gt;</code></p></li> <li><p>See the summary of changes again: <code>git diff --stat master@{1} master</code></p></li> </ul> <p>As for your question of "how do I know if I'm on master"... well, using branches is an important part of the Git workflow. You should always be aware of what branch you're on - if you pulled changes, you want to pull them to the right branch! You can see a list of all branches, with an asterisk by the currently checked-out one, with the command <code>git branch</code>. The current branch name is also printed along with the output of <code>git status</code>. I highly recommend skimming the man pages of commands to use - it's a great way to slowly pick up some knowledge.</p> <p>And your last question: <code>HEAD</code> is the name for the currently checked out branch. You can indeed use <code>HEAD</code> and <code>HEAD@{1}</code> in this context as well, but it's a bit more robust to use the branches, since if you go and check out another branch. <code>HEAD</code> is now that second branch, and <code>HEAD@{1}</code> is now <code>master</code> - not what you want!</p> <p>To save having to ask a lot of little questions like this, you should probably have a look at a Git tutorial. There are a million on the web, for example:</p> <ul> <li>The <a href="https://book.git-scm.com/book/en/v2" rel="noreferrer">Pro Git book</a></li> <li><a href="http://www-cs-students.stanford.edu/~blynn/gitmagic/" rel="noreferrer">Git Magic</a></li> <li>and the 4.5 million hits on Google for "Git tutorial"</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload