(Created page with "<metadesc>How to start using git</metadesc> *git init *git remote add <name> <url> *git pull <name> serverbranch:localbranch *git-push <name> localbranch:serverbranch ...")
 
Line 1: Line 1:
 
<metadesc>How to start using git</metadesc>
 
<metadesc>How to start using git</metadesc>
  
*git init
+
*Initializes a git repository on the current folder
 +
git init
  
*git remote add <name> <url>
+
*Add a remote git repository
 +
git remote add <name> <url>
  
*git pull <name> serverbranch:localbranch
+
*Fetches a remote git branch
 +
git pull <name> serverbranch:localbranch
  
*git-push <name> localbranch:serverbranch
+
*Adds a new file to git
 +
git add <filename>
 +
 
 +
*Saves the new changes to the git branch(local)
 +
git commit -m "<commit message>"
 +
 
 +
*Pushes the local branch to the server
 +
git push <name> localbranch:serverbranch
 +
 
 +
*Switches to a new branch
 +
git checkout <branchname>
 +
 
 +
*Creates and switches to a new branch
 +
git checkout -b <branchname>
 +
 
 +
*See all the merges
 +
git branch
 +
 
 +
*Merges a branch with the current branch
 +
git merge <branchname>
  
  
 
[[Category:Technical]]
 
[[Category:Technical]]

Revision as of 21:55, 2 December 2013


  • Initializes a git repository on the current folder
git init
  • Add a remote git repository
git remote add <name> <url>
  • Fetches a remote git branch
git pull <name> serverbranch:localbranch
  • Adds a new file to git
git add <filename>
  • Saves the new changes to the git branch(local)
git commit -m "<commit message>"
  • Pushes the local branch to the server
git push <name> localbranch:serverbranch
  • Switches to a new branch
git checkout <branchname>
  • Creates and switches to a new branch
git checkout -b <branchname>
  • See all the merges
git branch
  • Merges a branch with the current branch
git merge <branchname>


  • Initializes a git repository on the current folder
git init
  • Add a remote git repository
git remote add <name> <url>
  • Fetches a remote git branch
git pull <name> serverbranch:localbranch
  • Adds a new file to git
git add <filename>
  • Saves the new changes to the git branch(local)
git commit -m "<commit message>"
  • Pushes the local branch to the server
git push <name> localbranch:serverbranch
  • Switches to a new branch
git checkout <branchname>
  • Creates and switches to a new branch
git checkout -b <branchname>
  • See all the merges
git branch
  • Merges a branch with the current branch
git merge <branchname>