Warning: Declaration of PageLinesBanners::section_template($clone_id) should be compatible with PageLinesSection::section_template() in /home/c0nannet/public_html/blog/wp-content/themes/pagelines/sections/banners/section.php on line 205

Warning: Declaration of PageLinesFeatures::section_template($clone_id) should be compatible with PageLinesSection::section_template() in /home/c0nannet/public_html/blog/wp-content/themes/pagelines/sections/features/section.php on line 254

Warning: Declaration of PageLinesFeatures::section_head($clone_id) should be compatible with PageLinesSection::section_head() in /home/c0nannet/public_html/blog/wp-content/themes/pagelines/sections/features/section.php on line 61

Warning: Declaration of PageLinesHighlight::section_template($clone_id) should be compatible with PageLinesSection::section_template() in /home/c0nannet/public_html/blog/wp-content/themes/pagelines/sections/highlight/section.php on line 94

Warning: Declaration of PageLinesCarousel::section_template($clone_id) should be compatible with PageLinesSection::section_template() in /home/c0nannet/public_html/blog/wp-content/themes/pagelines/sections/carousel/section.php on line 168

Warning: Declaration of PLheroUnit::section_template($clone_id) should be compatible with PageLinesSection::section_template() in /home/c0nannet/public_html/blog/wp-content/themes/pagelines/sections/hero/section.php on line 140

Warning: Declaration of PLNavBar::section_template($clone_id, $location = '') should be compatible with PageLinesSection::section_template() in /home/c0nannet/public_html/blog/wp-content/themes/pagelines/sections/navbar/section.php on line 199

Warning: Declaration of PLMasthead::section_template($clone_id) should be compatible with PageLinesSection::section_template() in /home/c0nannet/public_html/blog/wp-content/themes/pagelines/sections/masthead/section.php on line 178

Warning: Declaration of PageLinesQuickSlider::section_template($clone_id) should be compatible with PageLinesSection::section_template() in /home/c0nannet/public_html/blog/wp-content/themes/pagelines/sections/quickslider/section.php on line 59

Warning: Declaration of PageLinesQuickSlider::section_head($clone_id) should be compatible with PageLinesSection::section_head() in /home/c0nannet/public_html/blog/wp-content/themes/pagelines/sections/quickslider/section.php on line 29
c0nan.net | Git me baby one more time

Git has truly caused some stir in the life of developers world wide. Why, cause not only does it conceptually work completely different than the popularly known Subversion, but it is also used and endorsed by probably the largest open source project to day: Linux, in fact it was developed by Linus Benedict Torvalds, the godfather of the Linux kernel (here, go read up on the guy: Linus Torvalds)

There are a few simple needs when one approaches source control.

The Git Concept:

{Server Repo} <—A—> {Local Repo} <—B—> {Staging} <—C—>{Working} <—D—>{Stash}

<—A—> New {Local repo}:

git init [newrepofolder]

New Branch

git branch [newbranch]

Merging another branch with current branch

git merge [branchname]

Cloning from a {Server repo}:

git clone [-d branchname] [remote address:remoterepository OR http://remote:123/abc/abc.git] [/path/to/local/repository/]

See Commit logs:

git log

Show {Local repo} commit details and diffs

git show [--name-only]

Show {Local repo} specific commit diffs

git show [<-commit ID->]

Sync {Local repo} to {Server repo}:

git push

Sync {Server Repo} to {Local repo}:

git pull
 <—B—> Commit {Staging} to {Local Repo}:

git commit -m "[Commit Comment]"

Revert {Staging} to {Working}:

git reset HEAD [filename.1}

Revert {Local Repo} to {Local Repo}(reverts the changes of the specified commit:

git revert [<-commit ID->]
 <—C—> shows changes in {working} and {staged}:

git status [-s]

Show differences between {working} and {staged}:

git diff [--name-only] / -U[0-9##]

Add Files to {staged}:

git add [.] / [filename.1] [filename.2]

Switch to another branch

git checkout [branchname]

Create and Switch {working} to another branch

git checkout -b [branchname]

Refresh {working} with {Local Repo}

git checkout [-f]

Show current {working} branch

git branch
 <—D—> Stash the current changes in {working} to {Stash} and reverts to HEAD:

git stash

Displays all the indexes in {Stash}:

git stash list

Apply an index from {Stash} to {working}:

git stash apply @stash{[0-9##]}

These are the basics you will need to survive the the average git using development shop.

Share →

Leave a Reply

Your email address will not be published. Required fields are marked *