aboutsummaryrefslogtreecommitdiffstats
path: root/dev/git/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'dev/git/index.html')
-rw-r--r--dev/git/index.html390
1 files changed, 25 insertions, 365 deletions
diff --git a/dev/git/index.html b/dev/git/index.html
index b2feb83..463b506 100644
--- a/dev/git/index.html
+++ b/dev/git/index.html
@@ -7,376 +7,36 @@
<body>
<a href="../index.html">Development Index</a>
- <h1>Git</h1>
-
- <p>First configure your global identity, configuration
- file resides on ~/.gitconfig ;</p>
-
- <pre>
- $ git config --global user.name "User Name"
- $ git config --global user.email user@devbox
- </pre>
-
- <p>If you want to disable pager / paging you can set globally;</p>
-
- <pre>
- $ git config --global core.pager cat
- </pre>
-
- <p>Paging based on output size with less;</p>
-
- <pre>
- $ git config --global core.pager "less -F -X"
- </pre>
-
- <p>Use <a href="../../tools/vim.html#vimdiff">vimdiff</a> as diff and merge tool;</p>
-
- <pre>
- $ git config --global diff.tool vimdiff
- $ git config --global merge.tool vimdiff
- $ git config --global difftool.prompt false
- $ git config --global merge.conflictstyle diff3
- </pre>
-
- <h2 id="teamwork">1. Team WorkFlow</h2>
-
- <p>Assumptions of this document;</p>
-
- <ul>
- <li>Correct
- <a href="../tools/gitolite.html#adminusers">user account</a>
- exists on git server or is public readable.
- </li>
- <li>Repository exists or
- <a href="../tools/gitolite.html#adminrep">create one</a>
- if you have permissions. This document uses atom as example.
- </li>
- <li>Correct
- <a href="../tools/openssh.html#sshid">ssh identities</a>,
- and profile alias have been setup. This document uses devbox as example.
- </li>
- </ul>
-
- <pre>
- $ git clone devbox:atom
- $ git remote -v
- </pre>
-
- <p>This work flow is based on
- <a href="http://nvie.com/posts/a-successful-git-branching-model/">Vicent Driessen</a>
- development model, it defines rules how branches are forked,
- merged and tagged. By having well defined set of branches,
- the project structure is used as a communication tool,
- allowing to work simultaneously on different stages
- of the development.</p>
-
- <p>Main Branches;</p>
-
- <pre>
- ___A___________AB_____ Master
- \___B_____/ \____ Develop
-
- </pre>
-
- <dl>
- <dt>master</dt>
- <dd>Current official stable release history.</dd>
- <dt>develop</dt>
- <dd>Integration branch for features.</dd>
- </dl>
-
- <p>Add-on Branches;</p>
-
- <pre>
- _A_________________AFR___________________AFRHR Master
- \ _AFR_/ \ _AFRHR_/\ Release
- \ / \_AFRH_/ \ Hotfix
- \________/_____________________________\__ Develop
- \_F_/ \_F1_/ Feature
-
- </pre>
-
- <dl>
- <dt>feature (f-)</dt>
- <dd>New features, improvement proposal, tests, etc...</dd>
- <dd>Only fork and merge from/to develop.
- <dt>release (r-)</dt>
- <dd>Next release, new features not allowed.</dd>
- <dd>Fork from develop, merges to master and develop.</dd>
- <dt>hotfix (h-)</dt>
- <dd>Hotfix only contain isolated bugfixes.</dd>
- <dd>Only fork from master, merges back to master and develop.</dd>
- </dl>
-
- <p>
- <h3 id="feature">1.1. Feature</h3>
-
- <p>Create a branch featurex from develop and checkout;</p>
-
- <pre>
- $ git checkout -b featurex develop
- </pre>
-
- <p>Push new branch to server</p>
-
- <pre>
- $ git push -u origin featurex
- </pre>
-
- <p>Rename a branch, if all feature branches start by "f-" is easy
- and quick to type and easy to spot;</p>
-
- <pre>
- $ git branch -m featurex f-xpto
- </pre>
-
- <p>Rename remote branch;</p>
-
- <pre>
- $ git push origin :featurex f-xpto
- $ git push origin -u f-xpto
- </pre>
-
- <p>Merge branch feature into develop;</p>
-
- <pre>
- $ git checkout develop
- Switched to branch 'develop'
- $ git merge --no-ff f-xpto
- Updating ea1b82a..05e9557
- (Summary of changes)
- $ git push origin develop
- </pre>
-
- <p>Delete Local;</p>
-
- <pre>
- $ git branch -D f-xpto
- </pre>
-
- <p>Delete Remote</p>
-
- <pre>
- $ git push origin :f-xpto
- </pre>
-
- <h3 id="release">1.2. Release</h3>
-
- <p>Software release numbers follow <a href="http://semver.org/">Tom Preston-Werner</a>
- description;</p>
-
- <pre>
- software-name-X.Y.Z.tar.xz
- </pre>
-
- <dl>
- <dt>X</dt>
- <dd>Major version, backwards incompatible API changes.</dd>
- <dt>Y</dt>
- <dd>Minor version, backwards-compatible changes.</dd>
- <dt>Z</dt>
- <dd>Patch version, backwards-compatible bug fixes.</dd>
- </dl>
-
- <pre>
- $ git checkout -b r-1.2.1 develop
- Switched to a new branch "release-1.2.1"
- $ ./bump-version.sh 1.2.1
- Files modified successfully, version bumped to 1.2.1.
- $ git commit -a -m "Bumped version number to 1.2.1"
- [release-1.2 74d9424] Bumped version number to 1.2.1
- 1 files changed, 1 insertions(+), 1 deletions(-)
- </pre>
-
- <p>Only documentation or bugfixes are allowed in this
- branch. When release is ready for production merge
- and push to master;</p>
-
- <pre>
- $ git checkout master
- Switched to branch 'master'
- $ git merge --no-ff r-1.2.1
- Merge made by recursive.
- </pre>
-
- <p>Tag new release with software-name-version, this
- allows meaningful ports
- <a href="../core/ports.html">distfiles</a> when
- downloading releases from git archives;</p>
- <pre>
- $ git tag -a software-name-1.2.1
- $ git push --follow-tags
- </pre>
-
- <p>Update branch develop with bugfixes from last release,
- conflict will happen in next step</p>
-
- <pre>
- $ git checkout develop
- Switched to branch 'develop'
- $ git merge --no-ff r-1.2.1
- Merge made by recursive.
- (Summary of changes)
- $ git push
- </pre>
-
- <h3 id="tags">1.3. Tags</h3>
-
- <p>There are two main types of tags, lightweight and
- annotated. Lightweight tag is a pointer to a specific commit,
- much like cheap branches. Annotated tags are stored as full objects
- and allow to sign with <a href="gnupg.html">gnupg</a>, making it ideal
- for distributing releases.</p>
-
- <p>Delete local and remote last end of life version;</p>
-
- <pre>
- $ git tag -d software-name-0.0.12
- $ git push origin :refs/tags/software-name-0.8
- </pre>
-
- <p>Checkout master commit you want to start long term support and then;</p>
-
- <pre>
- $ git tag -m "this commit is tagged" -a "software-name-1.1.8"
- $ git push --follow-tags
- </pre>
-
- <h3 id="hotfix">1.4. Hotfix</h3>
-
- <p>This branch should never exist, ;)</p>
-
- <pre>
- $ git checkout -b h-1.2.2 master
- $ ./bump-version.sh 1.2.2
- Files modified successfully, version bumped to 1.2.2
- $ git commit -a -m "Bumped version number to 1.2.2"
- </pre>
-
- <pre>
- $ git merge --no-ff b-error-xpto
- ...
- $ git merge --no-ff b-error-xpto
- ...
- $ git commit -m "Commit severe fix"
- ...
- $ git commit -m "Commit severe fix"
- ...
- </pre>
-
- <pre>
- $ git checkout master
- Switched to branch 'master'
- $ git merge --no-ff h-1.2.2
- Merge made by recursive.
- (Summary of changes)
- $ git tag -a software-name-1.2.2
- </pre>
-
- <p>Conflict will happen in next step</p>
-
- <pre>
- $ git checkout develop
- Switched to branch 'develop'
- $ git merge --no-ff h-1.2.2
- Merge made by recursive.
- (Summary of changes)
- </pre>
-
- <pre>
- $ git -D h-1.2.2
- </pre>
-
- <h2 id="local">2. Local Workflow</h2>
-
- <h3 id="working">2.1. Working area</h3>
-
- <p>Mark all deleted to commit;</p>
-
- <pre>
- $ git ls-files --deleted -z | xargs -0 git rm
- </pre>
-
- <p>Query last commit that affected current file path</p>
-
- <pre>
- $ git rev-list -n 1 HEAD -- .
- $ git show f000 path/to/file
- $ git diff --name-status f000 path/to/file
- </pre>
-
- <p>Undo a file to specific commit</p>
-
- <pre>
- $ git checkout f000^ -- path/to/file
- </pre>
-
- <p>Join multiple commits into single one;</p>
-
- <pre>
- $ git log --oneline
- $ git rebase -i oldest_commit_to_rewrite
- </pre>
-
- <h3 id="logdiff">2.2. Logs, diff commits</h3>
-
- <p>Create patch files to target branch/tag/ref;</p>
-
- <pre>
- $ git format-patch --no-prefix software-v0.0.1
- </pre>
-
- <p>Same using diff command;</p>
-
- <pre>
- $ diff -u orig file > file.patch
- </pre>
-
- <h3 id="remote">2.3. Working with remotes</h3>
-
- <p>Adding a new remote;</p>
-
- <pre>
- $ git remote add newremotename https://machine.example.org/repo.git
- </pre>
-
- <p>Update all branches with remote;</p>
-
- <pre>
- $ git fetch --all
- $ git pull --all
- </pre>
-
- <p>If you want to track all remotes run this line
- and then the commands mentioned above;</p>
-
- <pre>
- $ for remote in `git branch -r`; do git branch --track ${remote#origin/} $remote; done
- </pre>
-
- <p>Future updates;</p>
-
- <pre>
- $ git fetch --all
- $ git pull --all
- </pre>
-
- <p>Update local branches removed on remote set;</p>
-
- <pre>
- $ git config --global fetch.prune true
- </pre>
-
- <p>This will prune on fetch or you can keep it manually;</p>
+ <h1>Git</h1>
- <pre>
- $ git remote prune origin
- </pre>
+ <p>Git user documentation.</p>
+
+ <ul>
+ <li><a href="install.html">1. Install and configure</a></li>
+ <li><a href="work.html">2. Work.</a>
+ <ul>
+ <li><a href="work.html#local">2.1. Local workflow</a>
+ <li><a href="work.html#logdiff">2.2. Logs and commits</a></li>
+ <li><a href="work.html#remote">2.3. Working with remotes</a></li>
+ </ul>
+ </li>
+
+ <li><a href="branch.html">3. Branches</a>
+ <ul>
+ <li><a href="branch.html#teamwork">3.1. Team workflow</a></li>
+ <li><a href="branch.html#feature">3.2. Feature</a></li>
+ <li><a href="branch.html#release">3.3. Release</a></li>
+ <li><a href="branch.html#tags">3.4. Tags</a></li>
+ <li><a href="branch.html#hotfix">3.5. Hotfix</a></li>
+ </ul>
+ </li>
+ </ul>
<a href="../index.html">Development Index</a>
+
<p>This is part of the Hive System Documentation.
- Copyright (C) 2018
+ Copyright (C) 2019
Hive Team.
See the file <a href="../../fdl-1.3-standalone.html">Gnu Free Documentation License</a>
for copying conditions.</p>