diff options
Diffstat (limited to 'dev/git')
-rw-r--r-- | dev/git/branch.html | 37 | ||||
-rw-r--r-- | dev/git/index.html | 23 | ||||
-rw-r--r-- | dev/git/work.html | 69 |
3 files changed, 78 insertions, 51 deletions
diff --git a/dev/git/branch.html b/dev/git/branch.html index 2db02a2..24acff8 100644 --- a/dev/git/branch.html +++ b/dev/git/branch.html @@ -90,7 +90,7 @@ $ git commit -m "better implementation and tests." </pre> - <p>Prepare for testing and merge back;</p> + <p id="rebase">Prepare for testing and merge back;</p> <pre> $ git checkout featurex @@ -115,14 +115,14 @@ $ git branch -m featurex f-xpto </pre> - <p>Rename remote branch;</p> + <p id="push">Rename remote branch;</p> <pre> $ git push origin :featurex f-xpto $ git push origin -u f-xpto </pre> - <p>Merge branch feature into develop, first make sure is update with develop and history is clean;</p> + <p id="merge">Merge branch feature into develop, first make sure is update with develop and history is clean;</p> <pre> $ git checkout featurex @@ -190,11 +190,15 @@ $ git merge --no-ff r-1.2.0 Merge made by recursive. </pre> + <h3 id="tags">3.4. 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>Tag new release with projectname-version, this - allows meaningful ports - <a href="../core/ports.html">distfiles</a> when - downloading releases from git archives;</p> + <p id="tag">Tags are used to mark patch releases, get back in time to make security patches or to mark a new major or minor new release. Tag new release with projectname-version, this allows meaningful ports <a href="../core/ports.html">distfiles</a> when downloading releases from git archives;</p> <pre> $ git tag -a projectname-1.2.0 @@ -213,16 +217,6 @@ $ git push </pre> - <h3 id="tags">3.4. 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>Tags are used to mark patch releases, get back in time to make security patches or to mark a new major or minor new release.</p> - <p>Delete local and remote;</p> <pre> @@ -296,6 +290,15 @@ $ git -D h-error-name </pre> + <p id="cherry-pick">Some times is useful to pick the last commit that affected a path on other branch. To achieve this first get last commit that affected the path;</p> + + <pre> + $ git checkout upstream + $ git log -n 1 -- path/dir/or/file.c + $ git checkout stable-3.4 + $ git cherry-pick 9ce8b280e7081ec3c122b228cfa76600251ea6c9 + </pre> + <a href="index.html">Git Index</a> <p>This is part of the Hive System Documentation. Copyright (C) 2019 diff --git a/dev/git/index.html b/dev/git/index.html index 463b506..9794890 100644 --- a/dev/git/index.html +++ b/dev/git/index.html @@ -33,6 +33,29 @@ </li> </ul> + <p>Link to examples of following git commands.</p> + + <ul> + <li><a href="work.html#init">init</a></li> + <li><a href="work.html#status">status</a></li> + <li><a href="work.html#add">add</a></li> + <li><a href="work.html#commit">commit</a></li> + <li><a href="work.html#log">log</a></li> + <li><a href="work.html#ls-files">ls-files</a></li> + <li><a href="work.html#rev-list">rev-list</a></li> + <li><a href="work.html#checkout">checkout</a></li> + <li><a href="work.html#reset">reset</a></li> + <li><a href="work.html#format-patch">format-patch</a></li> + <li><a href="work.html#remote">remote</a></li> + <li><a href="work.html#fetch">fetch</a></li> + <li><a href="work.html#fetch">pull</a></li> + <li><a href="branch.html#rebase">rebase</a></li> + <li><a href="branch.html#push">push</a></li> + <li><a href="branch.html#merge">merge</a></li> + <li><a href="branch.html#tag">tag</a></li> + <li><a href="branch.html#cherry-pick">cherry-pick</a></li> + </ul> + <a href="../index.html">Development Index</a> <p>This is part of the Hive System Documentation. diff --git a/dev/git/work.html b/dev/git/work.html index 3111eaf..724df1c 100644 --- a/dev/git/work.html +++ b/dev/git/work.html @@ -10,58 +10,58 @@ <h1>1. Work</h1> - <p>Git is very easy to use and very useful to keep information in text or other formats. To start using just go to a directory where you will test git, add some files and; + <p id="init">Git is very easy to use and very useful to keep information in text or other formats. To start using just go to a directory where you will test git, add some files and; <pre> -$ git init + $ git init </pre> - <p>This initiates git directory and configuration files for this repository, you can see new directory ".git/". The next command says the status of your working directory, since no files have been added it will report "untracked files";</p> + <p id="status">This initiates git directory and configuration files for this repository, you can see new directory ".git/". The next command says the status of your working directory, since no files have been added it will report "untracked files";</p> <pre> -$ git status + $ git status </pre> - <p>Add all files to start tracking them;</p> + <p id="add">Add all files to start tracking them;</p> <pre> -$ git add . + $ git add . </pre> <p>Run again git status, it should report that new files have been added;</p> <pre> -$ git status + $ git status </pre> - <p>If you change any file it will report that the file have been changed at this moment, new changes can be added to current state of the files for the next commit. To commit;</p> + <p id="commit">If you change any file it will report that the file have been changed at this moment, new changes can be added to current state of the files for the next commit. To commit;</p> <pre> -$ git commit -m "initial commit" + $ git commit -m "initial commit" </pre> <h2 id="local">2.1. Local workflow</h2> - <p>Check ~/.bashrc for glog alias, help to check branches and their commit history;</p> + <p id="log">Check ~/.bashrc for glog alias, help to check branches and their commit history;</p> <pre> -# Git log -glog () { - git log --stat --decorate -} -# Git graph log -gloga () { - git log --graph --abbrev-commit --decorate --date=relative --all -} + # Git log + glog () { + git log --stat --decorate + } + # Git graph log + gloga () { + git log --graph --abbrev-commit --decorate --date=relative --all + } </pre> - <p>Mark all deleted to commit;</p> + <p id="ls-files">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> + <p id="rev-list">Query last commit that affected current file path</p> <pre> $ git rev-list -n 1 HEAD -- . @@ -69,7 +69,7 @@ gloga () { $ git diff --name-status f000 path/to/file </pre> - <p>Undo a file to specific commit</p> + <p id="checkout">Undo a file to specific commit</p> <pre> $ git checkout f000^ -- path/to/file @@ -82,7 +82,7 @@ gloga () { $ git rebase -i oldest_commit_to_rewrite </pre> - <p>Undo last commit;</p> + <p id="reset">Undo last commit;</p> <pre> $ git reset --soft HEAD~1 @@ -90,7 +90,7 @@ gloga () { <h2 id="logdiff">2.2. Logs, diff commits</h2> - <p>Create patch files to target branch/tag/ref;</p> + <p id="format-patch">Create patch files to target branch/tag/ref;</p> <pre> $ git format-patch --no-prefix software-v0.0.1 @@ -110,37 +110,37 @@ gloga () { $ git remote add newremotename https://machine.example.org/repo.git </pre> - <p>Update all branches with remote;</p> + <p>Update local branches removed on remote set automatically;</p> <pre> - $ git fetch --all - $ git pull --all + $ git config --global fetch.prune true </pre> - <p>If you want to track all remotes run this line - and then the commands mentioned above;</p> + <p>This will prune on fetch or you can keep it manually;</p> <pre> - $ for remote in `git branch -r`; do git branch --track ${remote#origin/} $remote; done + $ git remote prune origin </pre> - <p>Future updates;</p> + <p id="fetch">Update all branches with remote;</p> <pre> $ git fetch --all $ git pull --all </pre> - <p>Update local branches removed on remote set;</p> + <p>If you want to track all remotes run this line + and then the commands mentioned above;</p> <pre> - $ git config --global fetch.prune true + $ for remote in `git branch -r`; do git branch --track ${remote#origin/} $remote; done </pre> - <p>This will prune on fetch or you can keep it manually;</p> + <p>Future updates;</p> <pre> - $ git remote prune origin + $ git fetch --all + $ git pull --all </pre> <p>When using gitolite as remote, check following documentation;</p> @@ -161,6 +161,7 @@ gloga () { </ul> <a href="index.html">Git Index</a> + <p>This is part of the Hive System Documentation. Copyright (C) 2019 Hive Team. |