Git: Difference between revisions

From London Hackspace Wiki

13 bytes removed ,  25 February 2011
No edit summary
Line 31: Line 31:
== Committing ==
== Committing ==


First of all, create and edit the files as per usual. Now, to see to it that they're committed to the repo, do the following:
First of all, create and edit the files as per usual. You can what's changed by running:
 
git status
 
or
 
  git diff
 
Now, to see to it that they're committed to the repo, do the following:


  git add file1.sh file2*.py data/file3.txt
  git add file1.sh file2*.py data/file3.txt


This tells git which files you want to commit the changes for. You can always get an overview of what files have changed since the last commit by running '''git status'''.
This tells git which files you want to commit the changes for. Finally, use:


  git commit -m "A useful, but short, message on the changes"
  git commit -m "A useful, but short, message on the changes"
Line 41: Line 49:
This actually commits these changes, and attaches the comment after -m to the change to make it easy to see what changes you made at a glance. If you want to make a longer message, leave out -m, and you will be given a file in <code>vi</code> to edit.
This actually commits these changes, and attaches the comment after -m to the change to make it easy to see what changes you made at a glance. If you want to make a longer message, leave out -m, and you will be given a file in <code>vi</code> to edit.


Check your commit history using:
You should then check your commit history using:


  git log
  git log
3,313

edits