saved by5 people, first byMarko on 2007-10-26, last byDaniel Jomphe on 2008-08-11
Note that we didn't use "commit -a" this time. This means that "git
commit --amend" will amend only the commit message and not any of the
actual files being tracked, (even if some of them had been modified
between the commits).
It's also possible to use "git commit -a --amend" to similarly fix up
mistakes noticed in code. That will replace the most recent commit
with a different commit based on any new changes to files.
If you have a situation where you want to pull a single time from some
repository, then you can simply give the path or URL of the repository
on the "git pull" command line. However, it's often the case that if
you want to pull changes from a repository once, you'll want to pull
changes from that same repository again in the future. This is where
the "git remote" notion is extremely useful---it allows you to
associate simple names, (and behaviors), with remote repository URLs
We've already seen one instance of "git remote" which is the creation
of the "origin" remote which happens automatically during "git
clone". Let's now create another. Let's assume you are going to be
working in the hello-remote repository and you'd like to pull changes
from the hello-pull repository, where your friend "fred" has been
making changes. Here's how to setup the new remote:
Now, generally the
purpose of pushing to a repository is to have some "collaboration
point" where potentially multiple people might be pushing or
pulling. Because there might be multiple people pushing into the
repository at any point, it wouldn't make sense to have a
working-directory associated with this repository.
For this, git has the notion of a "bare" repository, which is simply a
repository with no working directory. Let's create a new bare
repository and push some changes into it: