A Git Cheat Sheet (Git Command Reference) - A Git Cheat Sheet and Command Reference
A Git Cheat Sheet (Git Command Reference) - A Git Cheat Sheet and Command Reference
com
$ git add .
and then:
$ git commit -m 'initial commit'
Note that your Git project directory will now have a .git subdirectory.
(Explore that directory for more information.)
[remote-url]
commands. I *think* you use git pull to get the latest changes from
the repository and have them automagically merged (or possibly to
overwrite) your local files (TODO - research this):
$ git pull
or
$ git pull [remote-name]
To pull down all the data from a remote project that you don't have,
so you can then do a manual merge, I *believe* git fetch is the
correct command:
$ git fetch
or
$ git fetch [remote-name]
Note from Pro Git:
Its important to note that the fetch command pulls the data to
your local repository it doesnt automatically merge it with any
of your work or modify what youre currently working on. You
have to merge it manually into your work when youre ready.
I think the "git fetch" workflow here looks something like this, but I
still have a lot to learn here:
$ git fetch origin
$ git log -p master origin/master
# manually check and adjust the differences
URL: ssh://user@host:port/path/to
/git/myapp.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (up to date)
This seems similar to the "cvs status" and "svn status" commands,
where you're comparing your local sandbox/repository to the
server's repository.
Git tagging
See the Pro Git tagging chapter for information on Git tagging.
Git branching
See the Pro Git Branching chapter for Git branching information.
Git help
Here's what the Git help output looks like on my current Mac
system:
Config file location
--global
--system
Action
--get
regex]
--get-all
[value-regex]
--get-regexp
name-regex [value-regex]
--replace-all
name value
--unset
name [value-regex]
removes a variable:
--unset-all
name [value-regex]
--rename-section
rename section:
old-name new-name
--remove-section
-l, --list
list all
-e, --edit
opens an editor
--get-color <slot>
configured: [default]
--get-colorbool <slot>
find the color setting:
[stdout-is-tty]
Type
--bool
value is "true" or
"false"
--int
--bool-or-int
--path
or directory name)
Other
-z, --null
NUL byte
Just type "git config" or something similar to see this Git usage
statement.
You can also type commands like these:
$ git help
$ git help [command]
Git log
Basic Git log commands:
$ git log
Git export
How to do a SVN-like "export" with Git:
git archive master | bzip2 > projectsource.tar.bz2
For more "Git export" information, type "git help archive" at your
command line.
(I found this answer on stackoverflow, thanks.)