Using git for version control

Possible Duplicate:
What is a version control system? How is Git useful?

I am new to Ruby on Rails platform, and so this may sound a little naive.

  • Git workflow for contributing small changes to a large collaborative project?
  • How to split a git repository while preserving subdirectories?
  • Create a patch with every commit in log output
  • How to detect whether a given remote repository is a Git repo or SVN repo?
  • Git can not clone repository when using bitvise ssh server
  • How to run Rubocop only on the changed files in a pull request?

  • Why and when do we store our work in a version control system like git?


    I mean what is the advantage of it ! Can’t we just keep it in our local machine ?

  • How could I mark a git branch as deprecated
  • Default remote for git fetch
  • Merging develop branch into master
  • git ignore permission for everyone
  • Using Git with a huge 200GB repository?
  • Copying code between Git branches
  • 5 Solutions collect form web for “Using git for version control”

    Advantages for using git/source control:

    For yourself

    • Remembering what you have coded and when you did it
    • Being able to compare what you did to previous work
    • Allow you to work on something experimental, and if it doesn’t work switch it back to where it was before

    Working with a team

    • It makes working with others easier – you can work on the same file at the same time and really easily combine your changes.
    • It will allow you to work in multiple locations and easily have the most recent code
    • It will help in deploying your code to a server

    example of a diff and branches

    Git workflow for teams

    Git branching model

    When to store or commit your work:

    You want to do this each time you finish on a particular “idea” or piece of work you are working on. This means you can have a useful commit message and can go back im time to that feature you just wrote or that bug that you just fixed.

    How often and when to commit

    Reasons for using Git over other source control

    • Its fast (switching branches is really fast and you have a local copy, so you dont have to communicate to a server for a lot of things unless you want to push or pull changes to the server)

    Yes, this seems quite naive, but every question is worth asking!

    First of all, using a SCM (software configuration manager) will greatly help you in a number of scenarios:

    • trying out experimental features without touching the main code
    • developing several independent ideas at the same time
    • recovering from failed changes, whenever they are complex and include changes in multiple files.
    • tracking the exact code used in a specific release, to fix a reported bug.

    This doesn’t even start to touch the infinite amount of work you’d have if working in a team without SCM.

    And using a SCM doesn’t involve network, git and any other distributed SCM is equally valid for local development, as the repository is all in your computer. You just don’t pull and push.

    The choice is not whether to store code in version control versus storing it on your local machine. In fact, unlike other version control systems (like Subversion, known also as svn), Git does not need a server to run.

    Version control makes it easy to understand what changes were made, view and restore older versions of files, and even import changes from one version to another.

    RETRIEVAL: Imagine you are working on a project on your own. You delete an old file you don’t think you need anymore. A week later, you realize that the file was very important. If you use version control, you can see what the file looked like just before you deleted it, and restore it as if it were never deleted. Also, most changes committed to version control contain messages; if you join a team and the previous developer used version control (with good commit messages) you can get an easier context for when changes were made and why.

    MULTIPLE RELEASES (BRANCHES): Now imagine that your software is version 1.0. You’re busy working on version 2.0, but someone files a bug. What can you do? With version control, you can zoom back to version 1.0, make some changes, and then create version 1.0.1. Most version control platforms even let you apply the changes made in version 1.0.1 onto the work you’re doing in version 2.0.

    MULTIPLE FEATURES: Your software is so successful, you start releasing it weekly. However, not every feature is ready for release. First you start working on the widget feature, than you start working on the doodad feature. If you work on both of these at the same time, you may have two half-coded features in development at the same time, and nothing is working well enough to release. With version control, once one of the features is done, you can merge it into the “main” release as if you wrote it in one day.

    COLLABORATION: Finally, now imagine that you’re in a team of five or six developers all working on the same code. Naturally, you don’t want to email zip files of code back and forth, especially when every developer is working on a separate feature. With version control, you can have a single history, to which all of your developers write and read.

    Naturally, some of the above can be done by keeping multiple copies of the same files in different adjacent directories. The benefit of version control software is that it can handle much of the work for you while avoiding duplicating the same file over and over on your disk.

    Long winded–sorry–but hope that helps!

    Advantages of using git:

    • Code will be safe in remote repo, even if the local project crashes
    • You can try out new things without worrying about previous works as they can retrieved
    • The code can accessed from anywhere in the world
    • When working in team, all the work will be stored in a single place so that it will be accessible to everybody in your team
    • Each and every change can be tracked easily, who did it and when they did it
    • Deployment of application will more easier
    • You can have multiple versions/branches so that it will be easy for you to identify the new features added to the application in every version

    you see @arulmr, @kieran-andrews, @Jeff and @rewritten that post many advantages but still if you want learn more in details you can see below links

    1) http://git-scm.com/book/ch8-1.html

    2) http://www-oss.fnal.gov/~mengel/git_vs_subversion.html.bak

    3) https://git.wiki.kernel.org/index.php/GitSvnComparison

    4) http://www.wikivs.com/wiki/Git_vs_Subversion #History, Architecture, Licensing, Performance, Features of git and svn

    now the difference between git and subversion

    1) http://boxysystems.com/index.php/5-fundamental-differences-between-git-svn/

    Git Baby is a git and github fan, let's start git clone.