文章目录
  1. 1. 2016-5-16
    1. 1.1. check out without change files
    2. 1.2. get SHA of first commit in git?
  2. 2. 2016-5-13
    1. 2.1. revert commit after push
    2. 2.2. unstage all
    3. 2.3. why git not track folder?
  3. 3. 2016-5-12
    1. 3.1. squash all commits to one commit at one point
  4. 4. 2016-5-9
    1. 4.1. find deleted file in history
    2. 4.2. gitlab wiki TOC
  5. 5. 2016-5-6
    1. 5.1. UNC link in gitlab
  6. 6. 2016-5-4
    1. 6.1. push tag
  7. 7. 2016-4-29
    1. 7.1. Delete remote branch
    2. 7.2. Error: src refspec … matches more than one
  8. 8. 2016-4-25
    1. 8.1. produce patch file
    2. 8.2. reflog of gitlab
    3. 8.3. Find reflog of remote repo.
    4. 8.4. How to audit force push in gitlab?
    5. 8.5. dot file management with git with proper ignore
  9. 9. 2016-4-24
    1. 9.1. word file git diff
    2. 9.2. git find biggest history
  10. 10. 2016-4-20
    1. 10.1. Move files to sub folder with history
    2. 10.2. Merge two repository
  11. 11. No Answer Questions
    1. 11.1. Find orphan pages in gitlab wiki

2016-5-16

check out without change files

git symbolic-ref HEAD refs/heads/branchname

get SHA of first commit in git?

git rev-list --max-parents=0 HEAD

2016-5-13

revert commit after push

git revert

unstage all

git reset

However, if the repository don’t have the first commit, you may want rm -rf .git && git init

why git not track folder?

No answer, however, without folder tracking merge a old branch to another branch which done rename a folder may not complete automatically.

2016-5-12

squash all commits to one commit at one point

No Answer

The scenario of this question is because some company open source its project without sharing the whole history, so it keeps two different history copy.

2016-5-9

find deleted file in history

git log --all -- FILEPATH(wildcard allowed)

gitlab wiki TOC

[[_TOC_]], NOTE: preview mode not work.

2016-5-6

1
file://///.....

2016-5-4

push tag

git push --follow-tags

2016-4-29

Delete remote branch

git push origin :branchname

Error: src refspec … matches more than one

Root cause is same name of branch and tag appears, usually we remove the conflicting tag to avoid the confliction.

2016-4-25

produce patch file

git diff commit[..commit] >xxx.patch

reflog of gitlab

Not supported in gitlab, github supported via API.

Find reflog of remote repo.

Not possible, because reflog is local only.

How to audit force push in gitlab?

No way, only to protect it.

dot file management with git with proper ignore

Add following pattern:

1
2
.*
!/.gitignore

Link

2016-4-24

word file git diff

  1. .gitattributes file in root folder of your git project

    1
    *.docx diff=pandoc
  2. .gitconfig file in your home folder

    1
    2
    3
    [diff "pandoc"]
    textconv=pandoc --to=markdown
    prompt = false

Link

git find biggest history

One-liner:

1
git rev-list --objects --all | grep "$(git verify-pack -v .git/objects/pack/*.idx | sort -k 3 -n | tail -10 | awk '{print$1}')"

Link

2016-4-20

Move files to sub folder with history

use filter-branch --tree-filter

Merge two repository

Directly merge them, you may want use filter-branch if subdirectory needed.

No Answer Questions

Find orphan pages in gitlab wiki

文章目录
  1. 1. 2016-5-16
    1. 1.1. check out without change files
    2. 1.2. get SHA of first commit in git?
  2. 2. 2016-5-13
    1. 2.1. revert commit after push
    2. 2.2. unstage all
    3. 2.3. why git not track folder?
  3. 3. 2016-5-12
    1. 3.1. squash all commits to one commit at one point
  4. 4. 2016-5-9
    1. 4.1. find deleted file in history
    2. 4.2. gitlab wiki TOC
  5. 5. 2016-5-6
    1. 5.1. UNC link in gitlab
  6. 6. 2016-5-4
    1. 6.1. push tag
  7. 7. 2016-4-29
    1. 7.1. Delete remote branch
    2. 7.2. Error: src refspec … matches more than one
  8. 8. 2016-4-25
    1. 8.1. produce patch file
    2. 8.2. reflog of gitlab
    3. 8.3. Find reflog of remote repo.
    4. 8.4. How to audit force push in gitlab?
    5. 8.5. dot file management with git with proper ignore
  9. 9. 2016-4-24
    1. 9.1. word file git diff
    2. 9.2. git find biggest history
  10. 10. 2016-4-20
    1. 10.1. Move files to sub folder with history
    2. 10.2. Merge two repository
  11. 11. No Answer Questions
    1. 11.1. Find orphan pages in gitlab wiki