Content by Category
.NET 1.x
.NET 2.0
.NET 3.0
.NET 3.5
.NET 4.0
.NET 4.5
.NET Assemblies
.NET Framework
.NET Getting Started
Accessibility
ADO.NET
Advertorials
Agile Development
AJAX
Amazon Web Services
Analysis Services
Android
Architecture
Arduino
ASP .NET Web API
ASP.NET
ASP.NET MVC
ASP.NET WebForms
Azure
B2B (Business Integration)
BDD
Big Data
Bing
BizTalk
Book Excerpts
Build and Deploy
Business Intelligence
C#
C++
ClickOnce
Cloud Computing
Code Contracts
CODE Framework Info - non Technical
CODE on the Road!
COM+
Community
Conferences
Continuous Integration
Crystal Reports
CSLA.NET
CSS
Data
Debugger
Design Patterns
Development Process
Display Technologies
Distributed Computing
Document Database
DotNetNuke
DSL
Dynamic Languages
Dynamic Programming
Editorials
Enterprise Services ("COM+")
Entity Framework
Events
Expression Blend
F#
Fox to Fox
Frameworks
Functional Programming
Git
Graphics
HTML 5
Internet Explorer 8.0
Interviews
IOS
iPhone
Iron Ruby
Java
Java Script
JavaScript
jQuery
JSON
Lightswitch
LINQ
Linux
LUA
Mac OS X
MDX
Messaging
Metro
Microsoft Application Blocks
Microsoft Business Rules Framework
Microsoft Dynamics
Microsoft Expression
Microsoft Office
Mobile Development
Mobile PC
Mono
MsBuild
MVVM
MySQL
Network
NHibernate
node.js
NOSQL
Nuget
Object Oriented Development
Objective C
Odata
OLAP
Open Source
Opinion
Opinions
Oracle
ORM
Other Languages
Parallel Programming
Patterns
PHP
Podcasts
Post Mortem
PowerPoint
Print/Output
Prism
Product News
Product Reviews
Project Management
Prolog
Python
Q&A
Rails
Rake
Razor
Reporting Services
REST
RIA Services
Ruby
Ruby on Rails
Scheme
Search
Security
Services
SharePoint
SignalR
Silverlight
SOA
Social Networks
Software & Law
Software Business
Source Control
Speech-Enabled Applications
SQL Server
SQL Server 2000
SQL Server 2005
SQL Server 2008
SQL Server 2012
SQL Server CE/AnyWhere/Mobile/Compact
SSIS
Subversion
Sync Framework
Tablet PC
TDD
Team System
Techniques
Testing and Quality Control
TFS
Tips
TypeScript
UI Design
UML
User Groups
VB Script
VB.NET
Version Control
VFP and .NET
VFP and SQL Server
Virtual Earth
Vista
Visual Basic
Visual Basic 6 (and older)
Visual FoxPro
Visual Studio .NET
Visual Studio 11
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Visual Studio 2011
Visual Studio 2012
Visual Studio Tools for Office
VSX
WCF
Web Development (general)
Web Services
WebMatrix
WF
Whitepapers
Windows 7
Windows 8
Windows Azure
Windows Live
Windows Phone 7
Windows Phone SDK
Windows Server
Windows Vista
WinForms
WinRT
Workflow
WPF
XAML
Xiine Documentation
XML
XNA
XSLT



LearnNow


XAMALOT
 


SSWUG

Reader rating:
Click here to read 1 comment about this article.
Article source: CoDe (2010 Jul/Aug)


Article Pages:  1  2 3 4 5 6 - Next >


Git, from a Developer's Perspective

What is Git? Git is a content-addressable file system wrapped in a version control system.That may sound complicated, but code snippets sometimes speak louder than words:

$ mkdir proj
$ cd proj
$ git init
Initialized empty Git repository in
proj/.git/

That folder, proj, is now a Git repository. It is that simple.

A Scenario

Lucas is working on ticket 1034 when Bishop, a systems analyst, comes by and lets him know about a pretty nasty bug in production. Lucas goes to the production system website and is able to recreate the bug. Management has decided fixing this bug is an absolute priority. Since Lucas has the most current knowledge about it, management assigns Lucas to develop a solution.

Lucas was working on a topic branch for ticket 1034 and had unfinished work. He stashes those changes, fetches the latest changes from the production branch, and then creates another topic branch from the production branch so he can apply the needed hot-fix. This is where Lucas would open his .NET solution and write failing tests, make them pass, and commit, fixing the production bug. He fetches from the remote production branch again to get any changes anyone else might have pushed up in the meantime, commits his changes locally, and then finally pushes his changes up to the remote production branch in preparation for a production hot-fix deployment. He moves the task to “committed” and goes back to working on ticket 1034.

I just described a possible scenario for a developer using Git, which is getting a lot of buzz in the .NET development arena. With the use of GitHub.com and social coding lately, Git’s popularity has increased.

Git

What is Git? Git is a content-addressable file system wrapped in a version control system. Huh? The simple answer is that it’s a distributed version control system. If you aren’t familiar with version control, it is the management of changes to files or sets of files, as related to software development. Git is the version control system for the Linux kernel and other popular projects (see the Works Cited sidebar). If you look on the Internet you can find many good resources already available on how to install Git so I won’t explain that here. So what is “distributed” source control? In layman’s terms it means you can still put your local code under version control without being connected to a remote server. This will become clearer by reading the remainder of this article.

Workflows

Learning the syntax is just memorization and muscle memory. The hardest part about Git, and most source control choices for that matter, is the workflow. Git users work with three popular remote workflows: Central Repository (Subversion style), Integration Manager, and Director/Lieutenants. In this article, I’ll focus on the first option as it is the most common workflow.

Central Repository (Subversion Style)

In this workflow, there is one “blessed” repository, usually remote on a centralized server. A developer will clone this central repository locally, work, pull any new changes, and then finally push their changes back to the central repository. This is how a developer works with other source control systems like Subversion. And as in Subversion, if two developers are working on tickets, the first one to push their changes back to the central repository will not have any issues. However, the second developer will be forced to pull down the first developer’s changes, handle any conflicts, and then push their changes up.

Using Git Locally on the Command Line

For the following sections I’ll use msysgit/Git Bash on a Windows 7 virtual machine. The dollar sign ($) is my command-line prompt, not something you will include in the commands issued. You can also perform the tasks through the Git Gui interface that’s available.

"
The first thing you should always do when working with Git is set up your name and email settings.
"

Git Init

As mentioned above, to create a Git repository, use the git init command:

$ mkdir proj
$ cd proj
$ git init
Initialized empty Git repository in
proj/.git/

The git init command creates a .git folder. In Subversion there is a .svn folder in every directory. Not so with Git, which has only the one .git folder.

Git Config

The first thing you should always do when working with Git is set up your name and email settings so that your information is attached to your commits:

$ git config --global user.name 
"John Doe"
$ git config --global user.email
jdoe@site.com

The --global argument is to tell Git that you want this user name and email assigned to any future repositories when logged in as this user to this machine. This will update the ~/.gitconfig file. For the non-*nix readers, the tilde sign (~) means your “home” directory or the C:\Users\<username> folder. If you used --system instead, you would have this setting as the default for all users. If they use the above git config command, it would supersede that system-wide setting. Omitting the --global or --system option would set this for a particular repository only. This way you could use a different email address and/or name on another repository.

Git Status

Running the git status command shows that you are on the local master branch and that there is nothing to commit:

$ git status
# On branch master
#
# Initial commit
#
nothing to commit (create/copy files
and use "git add" to track)

The following snippet will create two files, test1.txt and test2.txt, by writing (echoing) some text into them. Then you’ll run git status again:

$ echo "test1" test1.txt
$ echo "test2" test2.txt
$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to
include in what will be committed)
#
#       test1.txt
#       test2.txt
nothing added to commit but untracked
files present (use "git add" to track)
&

By: Adam Dymitruk

As a software professional, Adam Dymitruk specializes in .NET development, architecture, and Agile practices. Having consulted for numerous clients over the years, he has also acted as a coach, off-shore development coordinator, strategy consultant, technical lead, and development manager for various companies. He has incorporated his own software consulting company as of 1999. Adam has focused his efforts in helping the development community through many avenues such as the board of directors of Agile Vancouver, conference organization for ALT.NET Canada and the foundation of ALT.NET Vancouver. He has also taught I.T. courses at Langara College. Adam holds a couple of Microsoft certifications and an Associate of Science degree. In his spare time, Adam enjoys soccer and the Vancouver lifestyle.

adam@dymitruk.com

By: Jason Meridth

Jason Meridth is a continuously learning software developer. He has experience working for start-ups and Fortune 100 companies.. He has been running his own software company as a consultant since 2001. He believes in automation, test/behavior-driven design (TDD/BDD), open source, and empowering teams to succeed. He holds a bachelors degree in Computer Science. He is also the co-founder and maintainer of LosTechies.com, a very passionate blogging community. He is also the founder of AlamoCoders, a local software development user group in San Antonio, TX. In his free time he loves spending time with his family.

---

Jason Meridth

http://jason.lostechies.com

http://twitter.com/armmer

jmeridth@gmail.com



Article Pages:  1  2 3 4 5 6 - Next Page: 'Git Local Repository, Index, and Working Directory' >>

Page 1: Git, from a Developer's Perspective
Page 2: Git Local Repository, Index, and Working Directory
Page 3: Git Diff
Page 4: Visual Tools
Page 5: Git Bisect
Page 6: Git Submodules

How would you rate the quality of this article?
1 2 3 4 5
Poor      Outstanding

Tell us why you rated the content this way. (optional)

Average rating:
3 out of 5

6 people have rated this article.

Instantly Search Terabytes Of Text
“Lightning Fast”
– Redmond Mag
“Covers all data
sources” – eWeek
25+ fielded & full-text search options
dtSearch’s own document filters highlight hits in popular file types
Web Spider supports static & dynamic data
APIs for .NET, Java, C++, SQL, etc.
Win / Linux (64-bit & 32-bit)
www.dtSearch.com
 

      AppsWorld Europe

 

SSWUG