GIT GUD
git remote add : 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 [:] 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 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 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 '[1]' # list assume-unchanged files
git clean -f -d -n # (list only) unstaged files git clean -f -d # remove all unstaged files
git diff .. git diff .. --name-only git diff … --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 git update-index --no-assume-unchanged
git checkout -b / --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
[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
(~/.gitconfig) [alias] hist = log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short ignored = !git ls-files -v | grep "[2]"
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.