Status Check
{code}$ git status
(code}
Adding new files to the repo
(http://media.pragprog.com/titles/tsgit/chap-005-extract.html)* git add -A stages All (new, modified, deleted files that are not ignored)
* git add . stages new and modified, without deleted
* git add -u stages modified and updated, without new
Ignoring files
* create a text (hidden) file called '.gitignore'* Add the file filters that should be ignored by git
* Example
{code}
*.cmd
.tmp_versions*
Module.symvers
modules.order
*.ko
*.o
*.mod.c
{code}
* ?? Not sure if this needs to be at the top level or at each subfolder level
* ?? how to ignore subfolders (may be a moot point as they are not tracked)
Creating a diff patch from files modified
{code}$ git diff ???
{code}
Listing changed files
{code}git diff --stat
{code}
Various ways of getting diff status
{code}
$ git diff --stat[=
$ git diff --numstat
Similar to --stat, but shows number of added and deleted lines in decimal notation and pathname without abbreviation, to make it more machine friendly.
$ git diff --name-only (Show only path-filenames of changed files)
$ git diff --name-status (Shows only pathname-filename and status of changed files. See --diff-filter option on what the status letters mean)
--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]
Select only files that are Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type (i.e. regular file, symlink, submodule, ...) changed (T), are
Unmerged (U), are Unknown (X), or have had their pairing Broken (B). Any combination of the filter characters (including none) can be used. When * (All-or-none) is added to the combination, all paths are selected if there is any file that matches other criteria in the comparison; if there is no file that matches other criteria, nothing is selected.
{code}
Create a tarball of files that have changed
{code}
$ tar -cvzf
We can instead do this (obsolete):
$ git diff --stat | grep \|
==> This will only list the files and omit the last statement (searches for '|')
So the tarball can thus be created as such:
$ tar -cvzf n.tgz `git diff --stat | grep \| | awk '{print $1}'`
{code}
No comments:
Post a Comment