diff options
Diffstat (limited to 'dev/git')
-rw-r--r-- | dev/git/work.html | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/dev/git/work.html b/dev/git/work.html index b57bfb5..7f97af5 100644 --- a/dev/git/work.html +++ b/dev/git/work.html @@ -58,28 +58,28 @@ gloga () { <p>Mark all deleted to commit;</p> <pre> -$ git ls-files --deleted -z | xargs -0 git rm + $ 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 + $ 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 + $ 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 + $ git log --oneline + $ git rebase -i oldest_commit_to_rewrite </pre> <h2 id="logdiff">2.2. Logs, diff commits</h2> @@ -87,13 +87,13 @@ $ git rebase -i oldest_commit_to_rewrite <p>Create patch files to target branch/tag/ref;</p> <pre> -$ git format-patch --no-prefix software-v0.0.1 + $ git format-patch --no-prefix software-v0.0.1 </pre> <p>Same using diff command;</p> <pre> -$ diff orig file > file.patch + $ diff -u orig file > file.patch </pre> <h2 id="remote">2.3. Working with remotes</h2> @@ -101,40 +101,40 @@ $ diff orig file > file.patch <p>Adding a new remote;</p> <pre> -$ git remote add newremotename https://machine.example.org/repo.git + $ 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 + $ 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 + $ 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 + $ git fetch --all + $ git pull --all </pre> <p>Update local branches removed on remote set;</p> <pre> -$ git config --global fetch.prune true + $ 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 + $ git remote prune origin </pre> <p>When using gitolite as remote, check following documentation;</p> |