background preloader

GIt

Facebook Twitter

Git Tutorial: Branching and Merging | Wazi. Git Tutorial: Branching and Merging One of the most compelling features of the Git version control system (VCS) is its ability to create highly usable and lightweight branches, and the ease of merging those branches later. Branching creates multiple "copies" of the same repository and allows you to separate out a set of changes while you experiment with them, or to create different versions of a project, without affecting the main tree. It's a feature that developers sometimes don't make the most of, simply because branching is so much more costly in other VCSes that they're not used to it, or they're not aware of the many branch commands and tricks available in Git. Here's a host of useful tips to get your Git branching and merging skills up to expert level in no time.

Since it's so quick and easy to branch in Git, and equally easy to merge back into the main tree, it's worth branching whenever you're working on something new. The basic branch commands are: git log --oneline --decorate. 8 ways to share your git repository. This blogpost provides a summary of different ways to share a git repository. Depending on your needs you can opt for different solutions. Preparation:Git enable a simple project-X Let's say you have project called project-X that you have been working on, on your local machine. It contains one file called README. To enable git on this project you can: $ cd $HOME/project-X # git init enables the git repository $ git init # You add the readme file to the repository $ git add README # You commit your changed to your local repository $ git commit -a -m 'Added README' this will give you a .git directory in the project-X directory , ready to use in this tutorial Share it over a file share Instead of having people reference your local repository, you can put your repository on a file share.

Preparing the repository Pushing your local repository to the shared repository Share using git-daemon. Git is easy to learn. For a while now I've had to listen to people tell me that git is somehow more complicated than other distributed source code management tools. A very recent example was what Robert O'Callahansaid about a month ago talking about mercurial: Best of all the underlying model seems quite simple and I think I understand it having read a few chapters of hgbook. I used git with cairo without ever really understanding what git was doing.

This really confused me because I think I understand both git and mercurial fairly well, and I just don't see big user-visible differences in the "model" that they offer---particularly for new users. The model of each is basically identical. So I went and took a look at the book he referred to, (Distributed revision control with Mercurial by Bryan O'Sullivan).

So I thought it might be an interesting project to "port" this chapter from mercurial to git. But I also keep hearing more of this "git is hard to learn" and I felt that something needed to be done. FrontPage - GitWiki. From Git SCM Wiki (Redirected from FrontPage ) The survey will be open from to . The results will be published at GitSurvey2012 . Welcome to the Git wiki web site. Starting points Installation Git Tools – Git Documentation Git Community Support Projects using Git Documentation/SubmittingPatches Git Hosting Links to Git-related websites Git Compared Summer of Code 2011 projects Summer of Code 2012 ideas Git on Windows News October 03, 2011: Git User's Survey 2011 has been closed. September 05, 2011: Git User's Survey 2011 has been opened. August 20-21, 2011: Open Git-Workshop at FrOSCon , St. April 25, 2011: 5 Git projects accepted for Google Summer of Code 2011 (and at least five other git-related) March 18, 2011: Git has been accepted to the Google Summer of Code 2011 program.

October 15, 2010: Git User's Survey 2010 had been closed. September 1, 2010: Git User's Survey 2010 has been opened. June 30, 2010: GitTogether '10 announced. June 12, 2010: A new contributors-only Git for Windows was released . ToDo. Gitorious. Shared Repositories Should Be Bare Repositories - GitGuys - GitGuys. Commands discussed in this section: git init –bare Shared Repositories Should Be Bare Repositories When creating a central repository that will be shared by other users, the repositories should be created with the –bare option: gitadmin$ git init --bare project1.git Initialized empty Git repository in /home/gitadmin/project1.git/ When you create a git repository with the –bare option: There is no working directory created.There is no .git directory created.

Instead, the files normally in the .git directory are placed in the top-level directory where the working directory would normally be. gitadmin$ cd project1.git gitadmin$ ls branches/ config description HEAD hooks/ info/ objects/ refs/ The Bare Git Repository It is good that shared repositories don’t have working directories! For example, imagine someone creating a non-bare git repository with both the git repository user and remote users updating the git object database. Share Via git clone/pull/fetch/push. Git Management. Open source GitHub clone GitLab reaches version 3.0. Deploying at GitHub · GitHub Blog. GitHub needs to take open source seriously.

Some of the would-be cool kids of software say we are in the "post open source" world. Several weeks ago, James Governor, founder of analyst firm RedMonk, put it this way on Twitter: "younger devs today are about POSS - Post open source software. f*** the license and governance, just commit to github. " But as Outercurve Foundation's CTO Stephen Walli replied, "promiscuous sharing w/out a license leads to software transmitted diseases.

" Since then, I have heard more and more people mention this trend of regarding the copyright and collaboration terms of a project as irrelevant bureaucracy. Appealing as it may be to treat the wisdom of the years as pointless, doing so creates a problem for the future. [ GitHub CEO: We're helping software eat the world | Track the latest trends in open source with InfoWorld's Technology: Open Source newsletter. ] Whose code is it, anyway? You don't have to include a copyright statement for your creative work to be under copyright. Linux and Open source How to clone and share a Git repository over SSH. Only recently I’ve started to work with Git, don’t blame me I’m mainly a system administrator not a developer, and one of the things I’ve been asked to setup is a way to have a cloned Git project shared over SSH to a particular group of person that share the same linux group. The issue is this setting are the permissions that must be properly set so you and the others don’t end up stomping on each other when pushing changes, so let’s see how to achieve this goal quickly.

Creating a new shared repository over ssh If you just need to create a new git repository and share it via ssh with your co-workers you can issue the command: Explanation of the parameters: –bare = When you create a git repository with the –bare option these 2 things happen: There is no working directory created.There is no .git directory is created.

Check the following article to know why shared repositories should be bare repositories. umask (or false) – the default value. If you forgot to set it during the init phase.