about summary refs log tree commit diff stats
path: root/dev/git/work.html
diff options
context:
space:
mode:
authorSilvino Silva <silvino@bk.ru>2019-03-18 21:44:34 +0000
committerSilvino Silva <silvino@bk.ru>2019-03-19 02:30:35 +0000
commit25dc2312b8a023b49f0d085181c71ff2a8a4e692 (patch)
treebbec549f9d0f62a25e00dcd807f7d18529f4b922 /dev/git/work.html
parente67aefadd153bf622f56442c4e79df4704723616 (diff)
downloaddoc-25dc2312b8a023b49f0d085181c71ff2a8a4e692.tar.gz
git documentation revision
fix core conf ports
Diffstat (limited to 'dev/git/work.html')
-rw-r--r--dev/git/work.html164
1 files changed, 164 insertions, 0 deletions
diff --git a/dev/git/work.html b/dev/git/work.html
new file mode 100644
index 0000000..b57bfb5
--- /dev/null
+++ b/dev/git/work.html
@@ -0,0 +1,164 @@
+<!DOCTYPE html>
+<html dir="ltr" lang="en">
+<head>
+    <meta charset='utf-8'>
+    <title>Work</title>
+</head>
+<body>
+
+    <a href="index.html">Git Index</a>
+
+    <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;
+
+    <pre>
+$ 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>
+
+    <pre>
+$ git status
+    </pre>
+
+    <p>Add all files to start tracking them;</p>
+
+    <pre>
+$ git add .
+    </pre>
+
+    <p>Run again git status, it should report that new files have been added;</p>
+
+    <pre>
+$ 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>
+
+    <pre>
+$ 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>
+
+    <pre>
+# 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>
+
+    <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>
+
+    <h2 id="logdiff">2.2. Logs, diff commits</h2>
+
+    <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 orig file > file.patch
+    </pre>
+
+    <h2 id="remote">2.3. Working with remotes</h2>
+
+    <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>
+
+    <pre>
+$ git remote prune origin
+    </pre>
+
+    <p>When using gitolite as remote, check following documentation;</p>
+
+    <ul>
+        <li>Permission related problems check if correct
+            <a href="../../tools/gitolite.html#adminusers">user account</a>
+            exists on git server or is public readable.
+        </li>
+        <li>Repository related problems check if exists or
+            <a href="../../tools/gitolite.html#adminrep">create one</a>
+            user permissions.
+        </li>
+        <li>Local user account and configuration check correct
+            <a href="../../tools/openssh.html#sshid">ssh identities</a>,
+            and profile alias have been setup.
+        </li>
+    </ul>
+
+    <a href="index.html">Git Index</a>
+    <p>This is part of the Hive System Documentation.
+    Copyright (C) 2019
+    Hive Team.
+    See the file <a href="../../fdl-1.3-standalone.html">Gnu Free Documentation License</a>
+    for copying conditions.</p>
+</body>
+</html>