You are on page 1of 2

git init #intiialize repo in current folder

git log
git status
git config --list
git add .
git add *.txt
etc.
touch .gitignore
then in .gitignore file:
*.log
*.css
will ignore all log and css files (will NOT track them)
git add .
git commit -m 'notes on commit'
vs
git commit -a -m 'dasdasd' #the extra -a argument does the add stage automatical
ly
from within same folder as existing branch:
git branch "My Branch" #create new branch
#git branch #without anything else shows list of branches and which one you're o
n
git checkout "My Branch" #changes branches so can do stuff
git checkout master #switch back to master branch
git merge 'My Branch' #merges it with master branch (since you are currently in
the master branch)

can manually take care of merge conflicts, or use:


git mergetool #must have a mergetool installed, e.g. WinMerge or tortoise merge

git stash
#then sqitch branches and do stuff, not committing previous changes, but saving
them so not lost
git stash apply #now apply those changes again

#working w remote repos:

git remote #shows what remote repos you have


git remote -v #shows url's of your remote repos
git clone http://www.sdfsdlfkmsdlfk myname
#in following commands, origin is the alias for the url
git fetch origin #will get latest updates from repo but NOT merge them. You must
then merge manually
vs.
git pull origin #will get AND automatically merge

#to submit work to remote repo:


git commit -a -m 'asdasd'
git push origin master #push changes to the master branch of the repo known as o
rigin
#to add remote repo:
git remote add MyRepo http://asdnasdjkasd #MyRepo is the alis you want to give i
t

You might also like