markdown gitgit
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown gitgit相关的知识,希望对你有一定的参考价值。
Git
===
git remote add <name> <url>:<repo>
git remote add syngular syngular.es:strategems.git
git pull --rebase upstream branch
git pull --rebase origin develop
vs.
git merge upstream/branch
git merge origin/develop
git push <remote> <src>[:<dst>]
if src is empty, means delete remote branch: git push origin :master
git push origin :trocolo
git push syngular develop
git push syngular develop:refs/heads/master
git push -u <remote> <newbranch>
git push -u syngular newbranch
push the branch and set upstream to same branch in remote
git init -- bare && hooks/post-receive
git remote
git remote -v
git remote show <remote>
git remote show origin
git remote prune origin # will remove all ‘stale’ branches on the remote
git ls-remote
git ls-remote --heads origin
https://git-scm.com/docs/git-ls-files
git ls-files -v # list all files and their status
git ls-files -v | grep '^[[:lower:]]' # list assume-unchanged files
git clean -f -d -n # (list only) unstaged files
git clean -f -d # remove all unstaged files
git diff <branch1>..<branch2>
git diff <branch1>..<branch2> --name-only
git diff <branch1>…<branch2> --name-status
git checkout master
git merge --squash develop
git commit -m ‘Squashed all commits of develop into one to master’
git update-index --assume-unchanged <file>
git update-index --no-assume-unchanged <file>
git checkout -b <newbranch> <remote>/<remotebranch> --branch off upstream master to new branch
git cherry-pick --strategy=recursive -X theirs edb620b3820b3591d0eba94f348753fd40b2df6a
git diff-tree --no-commit-id --name-only -r edb620b3 --show files modified in commit
fetching prs
=========
[remote "upstream"]
url = git@github.com:Propertyfinder/pf-portal.git
fetch = +refs/heads/*:refs/remotes/upstream/*
fetch = +refs/pull/*/head:refs/remotes/upstream/pr/*
git fetch origin pull/7324/head:pr-7324
or..
git pull --rebase upstream pull/12345/head
aliases
=====
(~/.gitconfig)
[alias]
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
ignored = !git ls-files -v | grep "^[[:lower:]]"
Git Internals - Maintenance and Data Recovery
https://git-scm.com/book/en/v2/Git-Internals-Maintenance-and-Data-Recovery
git fsck [--full]
git fsck utility, which checks your database for integrity. If you run it with the --full option, it shows you all objects that aren’t pointed to by another object
git gc [--auto]
The “gc” stands for garbage collect, and the command does a number of things: it gathers up all the loose objects and places them in packfiles, it consolidates packfiles into one big packfile, and it removes objects that aren’t reachable from any commit and are a few months old.
You can run the count-objects command to quickly see how much space you’re using:
$ git count-objects -v
...
size-pack: 4868
...
The size-pack entry is the size of your packfiles in kilobytes, so you’re using almost 5MB.
以上是关于markdown gitgit的主要内容,如果未能解决你的问题,请参考以下文章