pBook‎ > ‎Git‎ > ‎

Git Tutorials

posted Dec 1, 2014, 6:14 AM by Javad Taghia   [ updated Dec 2, 2014, 6:48 AM ]
1. Creating repository on your computer: 
git clone https://gitub.com/username/projectname
2. making your name known to git.
git config --global user.email "you@example.com"
git config --global user.name "your name"

YouTube Video


git log:
shows you the log of the previous commits.
ps. press q to get out of it !

git reflog:
shows you the short list of the logs. 

git status:
shows you what changes have been done and need to be Added.

git Add .
Add every changes you made or be specific by 
git Add Readme
the file you want to add

git commit -m 'message'

commits the changes, it means you SAVE a state of the current folder to have it in mind to get back later. It's like a storage you push you commits to pull it when you want. 

After commit you need to send your changes to proper location on the gitbub. The job is done by:

git push origin master:
this command sends the changes to the website and sync it. The origin master is the location we are in. If there are other projects we work on then it's possible to push other stuff.

git pull origin master:
does the opposite one, it actually gets the changes on the local by syncing to the hub.

git show:
does show you your last commit and shows what went done. 

git show -h: 
it shows you some helps.

gitk
In a big project we use simple graphical interface

get checkout Readme
get the last one.

git --hard reset xdfsdf (it is the ref)
we make the one we want from the before commits to the start
If we want go back ver back in time. 

git push 
get the error 
we need to force it 

git push --force 

-------
Part 3:

YouTube Video


YouTube Video


changing from green state to red sate, it means we don't want to revert the ADD command.
git reset HEAD readme

ls -al 
to see everything

ignore list:
.gitingnore
in a textfile 
readfile

git rm --cached readme
to make it untrackable

--- merge conflicts
Part 4, 5:

YouTube Video


YouTube Video


mv  directory ~/  
moves the directory to a new place
by this command we are able to move the repository to a new place.

git --config color.vi true
to get colors

git mergetool

opendiff
file save 
git status again
rm the orig 

--- branching 
Part 6:

YouTube Video


you can make a new branch to work on the new feature and then 

we need a copy of the project]

git checkout -b newfeature 
create a new branch

git branch -a 

git push  origin newfeature

git checkout master // for switching to the branches

If we want to merge 
git branch shows you locals
 merge of new features on the origin master

when you are in master you merge new in it
git merge  newfeature 

git branch -d newfeature

del from the local

git push origin :newfeature

del from the remote

Comments