1 Git

1.1 Pro Git

git init
git add .
git commit -am "message here"

# branchit
git branch xyz # uusi branchi, jossa nykyisen branchin sisalto
git checkout xyz # vaihda branchiin
git branch -D xyz # poist branchi

# orphan branch - tyhja haara
git checkout --orphan gh-pages
git rm -rf . # tuhoa kaikki ennen committausta
# lisää haluamasi tiedostot (jekyll saitti esim.)
git add .
git commit -am "uus gh-pages haara"
git push origin gh-pages

Pushaa masteri sekä maste että gh-pages brancheihin

[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = git@github.com:muuankarski/luntti.git
fetch = +refs/heads/*:refs/remotes/origin/*
  push = +refs/heads/master:refs/heads/gh-pages 
push = +refs/heads/master:refs/heads/master 
[branch "master"]
remote = origin
merge = refs/heads/master

Vedä tietty branch (lähde)

git pull origin other-branch

Resettaa .gitignore (lähde)

git rm -r --cached .

git add .

git commit -m ".gitignore toimii taas"

vaihda github remote toiseen (lähde)

git remote set-url origin https://github.com/USERNAME/REPOSITORY_2.git

gh-pages

# delete old
git branch -D gh-pages # delete local
git push origin --delete gh-pages # delete remote
# create new
git checkout --orphan gh-pages
git commit -a -m "First pages commit"
git push origin gh-pages

misc

# paikallisen repon uppaaminen Githubiin

cd ~/workspace/courses/own_lectures_courses/openroadshow2013_tku
git remote add origin git@github.com:muuankarski/avointiede2013.git
git push -u origin master

# github pages

cd ~/workspace/courses/own_lectures_courses/openroadshow2013_tku
git fetch origin
git checkout gh-pages

git pull git@github.com:muuankarski/avointiede2013.git

## manually set up a github pages

git clone https://github.com/muuankarski/avointiede2013.git
git checkout --orphan gh-pages
git rm -rf .

echo "My GitHub Page" > index.html
git add index.html
git commit -a -m "First pages commit"

# Running git locally

git init
git add .
git committ -a -m "message"

git remote add origin git@github.com:muuankarski/attributions.git
git push -u origin master


Copyright © 2016 Markus Kainu. No rights reserved.

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.