Posted by & filed under Web Development.

As great and as useful branches are in Git, every once in a while we may forget to create a new branch when we meander off with experimental changes, or changes that may take longer to complete than changes you may want to commit in the meantime. No worries, it is still quite easy to commit only the files that you want with committing everything else. Here’s how…

As great and as useful branches are in Git, every once in a while we may forget to create a new branch when we meander off with experimental changes, or changes that may take longer to complete than changes you may want to commit in the meantime. No worries, it is still quite easy to commit only the files that you want with committing everything else.

Simply issue a “git status” to get a listing of all of the files that have changed, and identify which files you wish to commit. Then, commit then as follows:

git commit path/to/file1 path/to/file2 path/to/file3

You can commit as many files as you want simply by appending to the end of your “git commit” command.