Shammer's Philosophy

My private adversaria

Add file to git track target by CLI on Debian wheezy

The way how to clone the git repository from remote git repository to local is written as Try git on Debian wheezy - Shammerism. Today's article is how to add git track target.

At first, git status command teaches which files are tracked already, and which files are not tracked. Here is a sample.

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   file1.txt
	modified:   file2.txt
	deleted:    file3.txt
	deleted:    file4.txt

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	newdir/

no changes added to commit (use "git add" and/or "git commit -a")

Adding directory to git track target makes a result of git status changed. After this, the section of new target files will be added like below.

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

	new file:   tester/file1.sh
	new file:   tester/file2.sh

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

<-- SNIP -->

And repeat git add $FILE until all files which I would like to be tracking are added.
After all files are added to track target, execute git commit and git push.


When using -m option with git commit, we can add the comment to describe the updated contents. If no -m option, editor will be launched to add the comment.