Git Product home page Git Product logo

git-guide's Introduction

Introduction to Version Control Using Git

What is version control ?

Say you have a bunch of files that go together, such as source code for a project, or files for a website. Now if you want to keep an old version you have to archive a whole directory. Keeping many versions around by hand is inconvenient, and quickly becomes expensive.Version control systems are no different. They all have nice interfaces to manage a directory of stuff. You can save the state of the directory every so often, and you can load any one of the saved states later on.Version control systems are no different. They all have nice interfaces to manage a directory of stuff. You can save the state of the directory every so often, and you can load any one of the saved states later on.

Learning Objectives:

  • Learn basic command line interface commands

    • mkdir, cd, ls, rm, mv
    • installing git
  • Learn basic git commands

    • log, status, diff, stash, commit, add, rm, .gitignore, branch, checkout
    • cloning, pulling, push
  • Learn basic github actions:

    • pull requests, forking

Setting up git !

Download & Install Git From: http://git-scm.com/downloads

In your command prompt or terminal use the following commands for respective operations.

Configuring Git Settings (Initial Setup)

After installing git it is a good idea to introduce yourself to Git with your name and public email address before doing any operation. The easiest way to do so is:

git config --global user.email "[email protected]"

git config --global user.name "Your User Name Comes Here"

Checking Configuration

To check your credentials just run these commands git reply's with your name.

git config user.name

git config user.email

Make sure you run all these commands in your working folder / project folder

Making Repos

git init

You've just told your computer that you want git to watch the 'myProject' folder and keep track of any changes; basically making it so you can now run git commands inside of this folder.

git clone <url>

The clone is on an equal with the original project, possessing its own copy of the original project’s history.It just downloads the source file.

Adding Remote

git remote add origin https://github.com/user/repo.git

This remote helps you to interact with the same repository over and over again. By defining remote repository shorthand, you can make it easier.

Checking Added Remote

git remote -v

Making Changes

git status

Git briefs you about the current situation.

git add .

Git to take a snapshot of the contents of all files under the current directory.

git commit -m "Commit Message"

If you need to make any further adjustments, do so now, and then add any newly modified content to the index. Finally, commit your changes with a commit message.

git commit -am "Commit Message"

This command makes you to run two commands, one adding all the files and commit changes.

Pushing Repo Code

git push origin master

This is used to push commits made on your local branch to a remote repository.

Fetching and Pull

git fetch

git pull

License

Creative Commons Licence

This work is licensed under a Creative Commons Attribution 4.0 International License.

git-guide's People

Contributors

vihar avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.