Tuesday, April 11, 2017

git basics

basic workflow

Get bzw Checkout - from server to local repro

git config --list //list
  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

git clone https://github.com/username/reproname.git localDirName //get repro
git status //show changes
git log  //show last commits
git cherry -v //show commits needed to push

git fetch
git pull

anzeigen orgiginal url
git remote -v oder git config --get remote.origin.url.

push / checkin - from local to server

git add -A //stage changes

git commit -m "message"
ändern:
git commit --amend
git commit --amend -m "New commit message"
revert initial commit: git update-ref -d HEAD
git push

Revert

git checkout Dateiname

Stash

git stash list
git stash
git stash drop 1

Branches

switch to branch: git checkout branchname

https://git-scm.com/book/de/v1/Git-Branching-Einfaches-Branching-und-Merging

list all: git branch -a
list local: git branch -r
create: git branch myNewBranchName



merge:
git checkout destinationBranch (eg. master)
git merge branch (e.g. hotfix)
git branch -d hotfix //löschen

rebase:
git rebase -i HEAD~2

letzte 2 commits zusammenführen, es öffnet sich Editor, squash vor den commit schreiben den man "entfernen" will


Special

suda apt-get install git
git init --bare

git init
git remote -v
git remote add 




No comments: