Git Sheet

Branches

### Delete remote branch
git push origin --delete refs/heads/BRANCH_NAME

Tags

### List remote tags
git ls-remote --tags
### Checkout specific tag
git checkout refs/tags/TAG_NAME
### Delete remote tag
git push origin --delete refs/tags/TAG_NAME

Remotes

Add remote origin

### Add remote origin
git remote add origin gogs@rdd.ro:liv/dotFiles.git
### set the upstream branch to master
git push -u origin master
### To change it remove current origin and add a new one as above
git remote remove origin

Logs

### Log graph
git log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short

See commit log and changes before merging into working copy

### Fetch
git fetch origin
### Check the log and/or the changes
git log -p master..origin/master git log origin/master
### Merge
git merge origin/master

Deployment

Meaning: get the last version without the .git folder.

git archive --remote gogs@rdd.ro:liv/dotFiles.git HEAD | tar xvf - 
### OR only a sub-directory
git archive --remote gogs@rdd.ro:liv/dotFiles.git HEAD sub-directory | tar xvf -

My .gitconfig

[user]
name = liv
email = liviu@rdd.ro
[core]
autocrlf = input
safecrlf = true
whitespace = trailing-space,space-before-tab
[alias]
co = checkout
ci = commit
st = status --short --branch
br = branch
hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
type = cat-file -t
dump = cat-file -p
info = remote show origin
please = push --force-with-lease
[push]
default = simple
[fetch]
prune = true

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.