+See Documentation/gittutorial.txt to get started, then seeĭocumentation/everyday.txt for a useful minimum set of commands,Īnd "man git-commandname" for documentation of each command. See Documentation/tutorial.txt to get started, then see Please read the file INSTALL for installation instructions. It is currently maintained by Junio C Hamano. +++ -24,7 +24,7 It was originally written by Linus Torvalds with help of a group o ![]() If I wanted to know how the Git project README has changed since the initial 1.6 release, I can run ‘diff’ with a path limiter: $ git diff v1.6.0 - README One common question you may want answered is how a file has changed since a specific point in the history, like a tag. how a file has changed since a specific time However, there are other cool things you can use it for. Those three commands (really mostly ‘git diff’ and ‘git diff –staged’) are probably how you will most often be using the ‘diff’ command - they are often used sort of like a really detailed ‘git status’. It is relative to each users local repository, and changes as you switch between branches. If you are on the ‘master’ branch, HEAD refers to the most recent commit on that branch, if you are on the ‘experiment’ branch, it refers to the most recent commit there. In Git, HEAD refers to the last commit of the branch you are currently on. It is important to note that it is very different from what HEAD means in SVN, though. We haven’t covered what HEAD means in Git yet - we’ll go into that in greater detail in the ‘Intermediate’ lessons in this course. This is useful because it shows you what you would commit if you were to run ‘git commit -a’ at that point. You can see that it shows both staged and unstaged changes. $ git diffĭiff -git a/lib/simplegit.rb b/lib/simplegit.rb However, what was actually changed in ‘simplegit.rb’? How can I see what changes I’ve made that I’m going to stage? The answer is to just run ‘git diff’ with no arguments. " to discard changes in working directory) Running ‘git status’ will show us that README is staged and simplegit.rb is modified but not yet staged. Then we stage the README file with ‘git add’. ![]() Let’s say that we edit the simplegit.rb file to add a function, and we edit the README file to add a new author to the list. One of the most common things you’ll do with ‘git diff’ is to see what changes you’ve made in your working directory that have not been staged yet. This section will show you the different ways you can use diff to answer common quesions you might have about your repository. The ‘diff’ command in Git will show you the same thing - the changes between two snapshots or files in unified diff format. We saw in the ‘log’ section that adding a ‘-p’ will show you the differences that each commit introduces by showing diff of the snapshots of each commit and its parent.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |