{
    "mode": "info",
    "parameter": "giteveryday",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/giteveryday/json",
    "generated": "2026-07-11T06:45:16Z",
    "synopsis": "Everyday Git With 20 Commands Or So",
    "sections": {
        "NAME": {
            "content": "giteveryday - A useful minimum set of commands for Everyday Git\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "Everyday Git With 20 Commands Or So\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Git users can broadly be grouped into four categories for the purposes\nof describing here a small set of useful command for everyday Git.\n\no   Individual Developer (Standalone) commands are essential for\nanybody who makes a commit, even for somebody who works alone.\n\no   If you work with other people, you will need commands listed in the\nIndividual Developer (Participant) section as well.\n\no   People who play the Integrator role need to learn some more\ncommands in addition to the above.\n\no   Repository Administration commands are for system administrators\nwho are responsible for the care and feeding of Git repositories.\n\nINDIVIDUAL DEVELOPER (STANDALONE)\nA standalone individual developer does not exchange patches with other\npeople, and works alone in a single repository, using the following\ncommands.\n\no   git-init(1) to create a new repository.\n\no   git-log(1) to see what happened.\n\no   git-switch(1) and git-branch(1) to switch branches.\n\no   git-add(1) to manage the index file.\n\no   git-diff(1) and git-status(1) to see what you are in the middle of\ndoing.\n\no   git-commit(1) to advance the current branch.\n\no   git-restore(1) to undo changes.\n\no   git-merge(1) to merge between local branches.\n\no   git-rebase(1) to maintain topic branches.\n\no   git-tag(1) to mark a known point.\n\nExamples\nUse a tarball as a starting point for a new repository.\n\n$ tar zxf frotz.tar.gz\n$ cd frotz\n$ git init\n$ git add . (1)\n$ git commit -m \"import of frotz source tree.\"\n$ git tag v2.43 (2)\n\n1. add everything under the current directory.\n2. make a lightweight, unannotated tag.\n\nCreate a topic branch and develop.\n\n$ git switch -c alsa-audio (1)\n$ edit/compile/test\n$ git restore curses/uxaudiooss.c (2)\n$ git add curses/uxaudioalsa.c (3)\n$ edit/compile/test\n$ git diff HEAD (4)\n$ git commit -a -s (5)\n$ edit/compile/test\n$ git diff HEAD^ (6)\n$ git commit -a --amend (7)\n$ git switch master (8)\n$ git merge alsa-audio (9)\n$ git log --since='3 days ago' (10)\n$ git log v2.43.. curses/ (11)\n\n1. create a new topic branch.\n2. revert your botched changes in curses/uxaudiooss.c.\n3. you need to tell Git if you added a new file; removal and\nmodification will be caught if you do git commit -a later.\n4. to see what changes you are committing.\n5. commit everything, as you have tested, with your sign-off.\n6. look at all your changes including the previous commit.\n7. amend the previous commit, adding all your new changes, using\nyour original message.\n8. switch to the master branch.\n9. merge a topic branch into your master branch.\n10. review commit logs; other forms to limit output can be combined\nand include -10 (to show up to 10 commits), --until=2005-12-10,\netc.\n11. view only the changes that touch what's in curses/ directory,\nsince v2.43 tag.\n\nINDIVIDUAL DEVELOPER (PARTICIPANT)\nA developer working as a participant in a group project needs to learn\nhow to communicate with others, and uses these commands in addition to\nthe ones needed by a standalone developer.\n\no   git-clone(1) from the upstream to prime your local repository.\n\no   git-pull(1) and git-fetch(1) from \"origin\" to keep up-to-date with\nthe upstream.\n\no   git-push(1) to shared repository, if you adopt CVS style shared\nrepository workflow.\n\no   git-format-patch(1) to prepare e-mail submission, if you adopt\nLinux kernel-style public forum workflow.\n\no   git-send-email(1) to send your e-mail submission without corruption\nby your MUA.\n\no   git-request-pull(1) to create a summary of changes for your\nupstream to pull.\n\nExamples\nClone the upstream and work on it. Feed changes to upstream.\n\n$ git clone git://git.kernel.org/pub/scm/.../torvalds/linux-2.6 my2.6\n$ cd my2.6\n$ git switch -c mine master (1)\n$ edit/compile/test; git commit -a -s (2)\n$ git format-patch master (3)\n$ git send-email --to=\"person <email@example.com>\" 00*.patch (4)\n$ git switch master (5)\n$ git pull (6)\n$ git log -p ORIGHEAD.. arch/i386 include/asm-i386 (7)\n$ git ls-remote --heads http://git.kernel.org/.../jgarzik/libata-dev.git (8)\n$ git pull git://git.kernel.org/pub/.../jgarzik/libata-dev.git ALL (9)\n$ git reset --hard ORIGHEAD (10)\n$ git gc (11)\n\n1. checkout a new branch mine from master.\n2. repeat as needed.\n3. extract patches from your branch, relative to master,\n4. and email them.\n5. return to master, ready to see what's new\n6. git pull fetches from origin by default and merges into the\ncurrent branch.\n7. immediately after pulling, look at the changes done upstream\nsince last time we checked, only in the area we are interested in.\n8. check the branch names in an external repository (if not known).\n9. fetch from a specific branch ALL from a specific repository and\nmerge it.\n10. revert the pull.\n11. garbage collect leftover objects from reverted pull.\n\nPush into another repository.\n\nsatellite$ git clone mothership:frotz frotz (1)\nsatellite$ cd frotz\nsatellite$ git config --get-regexp '^(remote|branch)\\.' (2)\nremote.origin.url mothership:frotz\nremote.origin.fetch refs/heads/*:refs/remotes/origin/*\nbranch.master.remote origin\nbranch.master.merge refs/heads/master\nsatellite$ git config remote.origin.push \\\n+refs/heads/*:refs/remotes/satellite/* (3)\nsatellite$ edit/compile/test/commit\nsatellite$ git push origin (4)\n\nmothership$ cd frotz\nmothership$ git switch master\nmothership$ git merge satellite/master (5)\n\n1. mothership machine has a frotz repository under your home\ndirectory; clone from it to start a repository on the satellite\nmachine.\n2. clone sets these configuration variables by default. It arranges\ngit pull to fetch and store the branches of mothership machine to\nlocal remotes/origin/* remote-tracking branches.\n3. arrange git push to push all local branches to their\ncorresponding branch of the mothership machine.\n4. push will stash all our work away on remotes/satellite/*\nremote-tracking branches on the mothership machine. You could use\nthis as a back-up method. Likewise, you can pretend that mothership\n\"fetched\" from you (useful when access is one sided).\n5. on mothership machine, merge the work done on the satellite\nmachine into the master branch.\n\nBranch off of a specific tag.\n\n$ git switch -c private2.6.14 v2.6.14 (1)\n$ edit/compile/test; git commit -a\n$ git checkout master\n$ git cherry-pick v2.6.14..private2.6.14 (2)\n\n1. create a private branch based on a well known (but somewhat\nbehind) tag.\n2. forward port all changes in private2.6.14 branch to master\nbranch without a formal \"merging\". Or longhand\n\ngit format-patch -k -m --stdout v2.6.14..private2.6.14 | git am -3\n-k\n\nAn alternate participant submission mechanism is using the git\nrequest-pull or pull-request mechanisms (e.g as used on GitHub\n(www.github.com) to notify your upstream of your contribution.\n",
            "subsections": []
        },
        "INTEGRATOR": {
            "content": "A fairly central person acting as the integrator in a group project\nreceives changes made by others, reviews and integrates them and\npublishes the result for others to use, using these commands in\naddition to the ones needed by participants.\n\nThis section can also be used by those who respond to git request-pull\nor pull-request on GitHub (www.github.com) to integrate the work of\nothers into their history. A sub-area lieutenant for a repository will\nact both as a participant and as an integrator.\n\no   git-am(1) to apply patches e-mailed in from your contributors.\n\no   git-pull(1) to merge from your trusted lieutenants.\n\no   git-format-patch(1) to prepare and send suggested alternative to\ncontributors.\n\no   git-revert(1) to undo botched commits.\n\no   git-push(1) to publish the bleeding edge.\n\nExamples\nA typical integrator's Git day.\n\n$ git status (1)\n$ git branch --no-merged master (2)\n$ mailx (3)\n& s 2 3 4 5 ./+to-apply\n& s 7 8 ./+hold-linus\n& q\n$ git switch -c topic/one master\n$ git am -3 -i -s ./+to-apply (4)\n$ compile/test\n$ git switch -c hold/linus && git am -3 -i -s ./+hold-linus (5)\n$ git switch topic/one && git rebase master (6)\n$ git switch -C seen next (7)\n$ git merge topic/one topic/two && git merge hold/linus (8)\n$ git switch maint\n$ git cherry-pick master~4 (9)\n$ compile/test\n$ git tag -s -m \"GIT 0.99.9x\" v0.99.9x (10)\n$ git fetch ko && for branch in master maint next seen (11)\ndo\ngit show-branch ko/$branch $branch (12)\ndone\n$ git push --follow-tags ko (13)\n\n1. see what you were in the middle of doing, if anything.\n2. see which branches haven't been merged into master yet. Likewise\nfor any other integration branches e.g.  maint, next and seen.\n3. read mails, save ones that are applicable, and save others that\nare not quite ready (other mail readers are available).\n4. apply them, interactively, with your sign-offs.\n5. create topic branch as needed and apply, again with sign-offs.\n6. rebase internal topic branch that has not been merged to the\nmaster or exposed as a part of a stable branch.\n7. restart seen every time from the next.\n8. and bundle topic branches still cooking.\n9. backport a critical fix.\n10. create a signed tag.\n11. make sure master was not accidentally rewound beyond that\nalready pushed out.\n12. In the output from git show-branch, master should have\neverything ko/master has, and next should have everything ko/next\nhas, etc.\n13. push out the bleeding edge, together with new tags that point\ninto the pushed history.\n\nIn this example, the ko shorthand points at the Git maintainer's\nrepository at kernel.org, and looks like this:\n\n(in .git/config)\n[remote \"ko\"]\nurl = kernel.org:/pub/scm/git/git.git\nfetch = refs/heads/*:refs/remotes/ko/*\npush = refs/heads/master\npush = refs/heads/next\npush = +refs/heads/seen\npush = refs/heads/maint\n",
            "subsections": []
        },
        "REPOSITORY ADMINISTRATION": {
            "content": "A repository administrator uses the following tools to set up and\nmaintain access to the repository by developers.\n\no   git-daemon(1) to allow anonymous download from repository.\n\no   git-shell(1) can be used as a restricted login shell for shared\ncentral repository users.\n\no   git-http-backend(1) provides a server side implementation of\nGit-over-HTTP (\"Smart http\") allowing both fetch and push services.\n\no   gitweb(1) provides a web front-end to Git repositories, which can\nbe set-up using the git-instaweb(1) script.\n\nupdate hook howto[1] has a good example of managing a shared central\nrepository.\n\nIn addition there are a number of other widely deployed hosting,\nbrowsing and reviewing solutions such as:\n\no   gitolite, gerrit code review, cgit and others.\n\nExamples\nWe assume the following in /etc/services\n\n$ grep 9418 /etc/services\ngit             9418/tcp                # Git Version Control System\n\nRun git-daemon to serve /pub/scm from inetd.\n\n$ grep git /etc/inetd.conf\ngit     stream  tcp     nowait  nobody \\\n/usr/bin/git-daemon git-daemon --inetd --export-all /pub/scm\n\nThe actual configuration line should be on one line.\n\nRun git-daemon to serve /pub/scm from xinetd.\n\n$ cat /etc/xinetd.d/git-daemon\n# default: off\n# description: The Git server offers access to Git repositories\nservice git\n{\ndisable = no\ntype            = UNLISTED\nport            = 9418\nsockettype     = stream\nwait            = no\nuser            = nobody\nserver          = /usr/bin/git-daemon\nserverargs     = --inetd --export-all --base-path=/pub/scm\nlogonfailure  += USERID\n}\n\nCheck your xinetd(8) documentation and setup, this is from a Fedora\nsystem. Others might be different.\n\nGive push/pull only access to developers using git-over-ssh.\ne.g. those using: $ git push/pull ssh://host.xz/pub/scm/project\n\n$ grep git /etc/passwd (1)\nalice:x:1000:1000::/home/alice:/usr/bin/git-shell\nbob:x:1001:1001::/home/bob:/usr/bin/git-shell\ncindy:x:1002:1002::/home/cindy:/usr/bin/git-shell\ndavid:x:1003:1003::/home/david:/usr/bin/git-shell\n$ grep git /etc/shells (2)\n/usr/bin/git-shell\n\n1. log-in shell is set to /usr/bin/git-shell, which does not allow\nanything but git push and git pull. The users require ssh access to\nthe machine.\n2. in many distributions /etc/shells needs to list what is used as\nthe login shell.\n\nCVS-style shared repository.\n\n$ grep git /etc/group (1)\ngit:x:9418:alice,bob,cindy,david\n$ cd /home/devo.git\n$ ls -l (2)\nlrwxrwxrwx   1 david git    17 Dec  4 22:40 HEAD -> refs/heads/master\ndrwxrwsr-x   2 david git  4096 Dec  4 22:40 branches\n-rw-rw-r--   1 david git    84 Dec  4 22:40 config\n-rw-rw-r--   1 david git    58 Dec  4 22:40 description\ndrwxrwsr-x   2 david git  4096 Dec  4 22:40 hooks\n-rw-rw-r--   1 david git 37504 Dec  4 22:40 index\ndrwxrwsr-x   2 david git  4096 Dec  4 22:40 info\ndrwxrwsr-x   4 david git  4096 Dec  4 22:40 objects\ndrwxrwsr-x   4 david git  4096 Nov  7 14:58 refs\ndrwxrwsr-x   2 david git  4096 Dec  4 22:40 remotes\n$ ls -l hooks/update (3)\n-r-xr-xr-x   1 david git  3536 Dec  4 22:40 update\n$ cat info/allowed-users (4)\nrefs/heads/master       alice\\|cindy\nrefs/heads/doc-update   bob\nrefs/tags/v[0-9]*       david\n\n1. place the developers into the same git group.\n2. and make the shared repository writable by the group.\n3. use update-hook example by Carl from Documentation/howto/ for\nbranch policy control.\n4. alice and cindy can push into master, only bob can push into\ndoc-update. david is the release manager and is the only person who\ncan create and push version tags.\n",
            "subsections": []
        },
        "GIT": {
            "content": "Part of the git(1) suite\n",
            "subsections": []
        },
        "NOTES": {
            "content": "1. update hook howto\nfile:///usr/share/doc/git/html/howto/update-hook-example.html\n\nGit 2.34.1                        02/26/2026                    GITEVERYDAY(7)",
            "subsections": []
        }
    },
    "summary": "giteveryday - A useful minimum set of commands for Everyday Git",
    "flags": [],
    "examples": [],
    "see_also": []
}