Difference between revisions of "Git"

From HackerNet
Jump to: navigation, search
(Created page with "'''WIP''' Git är ett versionshanteringsprogram som är gratis och open source. Det skapades 2005 för att hantera källkoden till Linuxkärnan. =Installation= sudo apt-get...")
 
Line 6: Line 6:
 
  sudo apt-get install git-core
 
  sudo apt-get install git-core
  
 +
=Konfiguration=
 +
Status
 +
git status
 +
 +
===Repo===
 +
Skapa nytt repo
 
  mkdir ~/dev && cd ~/dev
 
  mkdir ~/dev && cd ~/dev
 
  echo "reponame" >> README.md
 
  echo "reponame" >> README.md
Line 11: Line 17:
 
  git add README.md
 
  git add README.md
 
  git commit -m "first commit"
 
  git commit -m "first commit"
   
+
 
 +
Klona repo
 +
  git clone https://github.com/USERNAME/REPONAME.git
 +
 
 +
===Branch===
 +
Skapa en ny branch
 +
git checkout -b NAME
 +
git branch
 +
 
 
=GitHub=
 
=GitHub=
 +
Username
 
  git config --global user.name "Programming"
 
  git config --global user.name "Programming"
 
  git config --global user.email "user@hackernet.se"
 
  git config --global user.email "user@hackernet.se"
Line 18: Line 33:
 
  git remote add origin https://github.com/user/reponame.git
 
  git remote add origin https://github.com/user/reponame.git
 
  git push -u origin master
 
  git push -u origin master
 +
 +
Password cache
 +
git config --global credential.helper cache
 +
git config --global credential.helper 'cache --timeout=3600'

Revision as of 17:30, 1 January 2016

WIP

Git är ett versionshanteringsprogram som är gratis och open source. Det skapades 2005 för att hantera källkoden till Linuxkärnan.

Installation

sudo apt-get install git-core

Konfiguration

Status

git status

Repo

Skapa nytt repo

mkdir ~/dev && cd ~/dev
echo "reponame" >> README.md
git init
git add README.md
git commit -m "first commit"

Klona repo

git clone https://github.com/USERNAME/REPONAME.git

Branch

Skapa en ny branch

git checkout -b NAME
git branch

GitHub

Username

git config --global user.name "Programming"
git config --global user.email "user@hackernet.se"
git remote add origin https://github.com/user/reponame.git
git push -u origin master

Password cache

git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=3600'