giteveryday(7)
==============
NAME
----
giteveryday - A useful minimum set of commands for Everyday Git
SYNOPSIS
--------
Everyday Git With 20 Commands Or So
DESCRIPTION
-----------
Git users can broadly be grouped into four categories for the purposes of
describing here a small set of useful commands for everyday Git.
* <<STANDALONE,Individual Developer (Standalone)>> commands are essential
for anybody who makes a commit, even for somebody who works alone.
* If you work with other people, you will need commands listed in
the <<PARTICIPANT,Individual Developer (Participant)>> section as well.
* People who play the <<INTEGRATOR,Integrator>> role need to learn some
more commands in addition to the above.
* <<ADMINISTRATION,Repository Administration>> commands are for system
administrators who are responsible for the care and feeding
of Git repositories.
Individual Developer (Standalone)[[STANDALONE]]
-----------------------------------------------
A standalone individual developer does not exchange patches with
other people, and works alone in a single repository, using the
following commands.
* linkgit:git-init[1] to create a new repository.
* linkgit:git-log[1] to see what happened.
* linkgit:git-switch[1] and linkgit:git-branch[1] to switch
branches.
* linkgit:git-add[1] to manage the index file.
* linkgit:git-diff[1] and linkgit:git-status[1] to see what
you are in the middle of doing.
* linkgit:git-commit[1] to advance the current branch.
* linkgit:git-restore[1] to undo changes.
* linkgit:git-merge[1] to merge between local branches.
* linkgit:git-rebase[1] to maintain topic branches.
* linkgit:git-tag[1] to mark a known point.
Examples
~~~~~~~~
Use a tarball as a starting point for a new repository.::
+
------------
$ tar zxf frotz.tar.gz
$ cd frotz
$ git init
$ git add . <1>
$ git commit -m "import of frotz source tree."
$ git tag v2.43 <2>
------------
+
<1> add everything under the current directory.
<2> make a lightweight, unannotated tag.
Create a topic branch and develop.::
+
------------
$ git switch -c alsa-audio <1>
$ edit/compile/test
$ git restore curses/ux_audio_oss.c <2>
$ git add curses/ux_audio_alsa.c <3>
$ edit/compile/test
$ git diff HEAD <4>
$ git commit -a -s <5>
$ edit/compile/test
$ git diff HEAD^ <6>
$ git commit -a --amend <7>
$ git switch master <8>
$ git merge alsa-audio <9>
$ git log --since='3 days ago' <10>
$ git log v2.43.. curses/ <11>
------------
+
<1> create a new topic branch.
<2> revert your botched changes in `curses/ux_audio_oss.c`.
<3> you need to tell Git if you added a new file; removal and
modification will be caught if you do `git commit -a` later.
<4> to see what changes you are committing.
<5> commit everything, as you have tested, with your sign-off.
<6> look at all your changes including the previous commit.
<7> amend the previous commit, adding all your new changes,
using your original message.
<8> switch to the master branch.
<9> merge a topic branch into your master branch.
<10> review commit logs; other forms to limit output can be
combined and include `-10` (to show up to 10 commits),
`--until=2005-12-10`, etc.
<11> view only the changes that touch what's in `curses/`
directory, since `v2.43` tag.
Individual Developer (Participant)[[PARTICIPANT]]
-------------------------------------------------
A developer working as a participant in a group project needs to
learn how to communicate with others, and uses these commands in
addition to the ones needed by a standalone developer.
* linkgit:git-clone[1] from the upstream to prime your local
repository.
* linkgit:git-pull[1] and linkgit:git-fetch[1] from "origin"
to keep up-to-date with the upstream.
* linkgit:git-push[1] to shared repository, if you adopt CVS
style shared repository workflow.
* linkgit:git-format-patch[1] to prepare e-mail submission, if
you adopt Linux kernel-style public forum workflow.
* linkgit:git-send-email[1] to