Re: Basic Git Questions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Dec 19, 2010 at 02:32:41PM -0800, Parag Kalra wrote:

> 1. I generally add the files in my working directory using "git add
> .". But sometimes you want to add all the files except 1 or 2 file. Is
> there a shortcut way we can tell git to add all the files but exclude
> a particular file.
Use `git add .` to add all the files and then `git rm --cached` those
one or two you don't need to be committed. See the git-rm manual for
details.

> 2. Also sometime when the code is committed, I realize that I have
> forgot to change or add a file. Is there a way we can we commit a file
> to existing commit number with git log showing only the old git commit
> number and not creating a new one for the last commit.
`git commit --amend` does exactly that -- amends the last commit
(pointed by the HEAD ref).
If you need to modify a commit older than the last one, you have to
rebase a part of the branch starting with that commit and then edit
(amend) that commit during the rebasing process. This might have
certain caveats though, so refer to git-rebase manual.
More on rebasing can be found in various pieces of documentation and
books listed at http://git-scm.com/documentation

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]