From: Konstantin Khomoutov <flatworm@users.sourceforge.net>
To: Parag Kalra <paragkalra@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Basic Git Questions
Date: Mon, 20 Dec 2010 02:08:39 +0300 [thread overview]
Message-ID: <20101219230839.GM3264@localhost.localdomain> (raw)
In-Reply-To: <AANLkTiki2e4-YD0P9kb7g-WbLTPhAXQ22R2jCAXVtjN1@mail.gmail.com>
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
next prev parent reply other threads:[~2010-12-19 23:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-19 22:32 Basic Git Questions Parag Kalra
2010-12-19 23:08 ` Konstantin Khomoutov [this message]
2010-12-19 23:15 ` Thomas Rast
-- strict thread matches above, loose matches on Subject: below --
2010-12-20 19:21 George Spelvin
2010-12-21 2:59 ` Adam Kellas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101219230839.GM3264@localhost.localdomain \
--to=flatworm@users.sourceforge.net \
--cc=git@vger.kernel.org \
--cc=paragkalra@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).