GIT Making changes

Posted under » Version Control on 23 Aug 2018

Modify some files, then add their updated contents to the index

$ git add folio.php tolio.txt

You can edit as many times as you like and it will be in the "cache". Once you are now ready to commit. You can see what is about to be committed using git diff with the --cached option:

$ git diff --cached

(Without --cached, git diff will show you any changes that you’ve made but not yet added to the index.) You can also get a brief summary of the situation with git status:

$ git status
On branch master
Changes to be committed:
Your branch is up to date with 'origin/master'.
  (use "git reset HEAD <file>..." to unstage)
	modified:   file1
	modified:   file2
	modified:   file3

If you need to make any further adjustments, do so now, and then add any newly modified content to the index. Finally, commit your changes with:

$ git commit

This will again prompt you for a message describing the change, and then record a new version of the project.

Alternatively, instead of running git add beforehand, you can use

$ git commit -a

which will automatically notice any modified (but not new) files, add them to the index, and commit, all in one step.

A note on commit messages: Though not required, it’s a good idea to begin the commit message with a single short (less than 50 character) line summarizing the change, followed by a blank line and then a more thorough description. The text up to the first blank line in a commit message is treated as the commit title, and that title is used throughout Git. For example, git-format-patch[1] turns a commit into email, and it uses the title on the Subject line and the rest of the commit in the body.

» next | previous

web security linux ubuntu python django git Raspberry apache mysql php drupal cake javascript css AWS data