Git: Difference between revisions

From Halfface
Jump to navigation Jump to search
Line 54: Line 54:
=look at content of file=
=look at content of file=
  git show 123131234242411fs1fds234fds14f1s4:/git/file.java
  git show 123131234242411fs1fds234fds14f1s4:/git/file.java
=download specific version of file=
git show af5bb0fe325300844195975a2f0c1f82979a7dd6:./git/search/path/file.txt > /temp/file.txt.af5bb0fe325300844195975a2f0c1f82979a7dd6

Revision as of 12:22, 8 October 2019

Download a git repository

git clone git@www.halfface.se:project.git

which changes has occured

git status

commit changes

git commit -a -m "updated ..."

push changes upsteam

git push
git push origin master

list branches

List local and remote branches.

git branch -a

list remote branches.

git branch -r

Change branch

git checkout remotes/origin/code-18500

Change branch

git branch master

git pull

sync up against git head

git pull

list files from specific branch, e.g. master

git ls-tree -r master --name-only

If you want to get a list of all files that ever existed

git log --pretty=format: --name-status | cut -f2- | sort -u

show where git repository is coming from/source

git remote show origin

git list tags

git tag -n

git diff

Difference between tags.

git diff tag1 tag2

Only show name of changed files.

git diff --name-only tag1 tag2

List all sha1 codes for all objects

git rev-list --objects --all

git revert local changes

git reset --hard ; git clean -fd

list tags containing commit

git tag --contains ${commit}

list dates in iso format

git log --date=iso ./lib/IPsoft/IPdiscover/Module/Ish/ApplicationServer.pm

look at content of file

git show 123131234242411fs1fds234fds14f1s4:/git/file.java

download specific version of file

git show af5bb0fe325300844195975a2f0c1f82979a7dd6:./git/search/path/file.txt > /temp/file.txt.af5bb0fe325300844195975a2f0c1f82979a7dd6