Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Configure username and email using Git Bash
$git config --global user.name "your name"
$git config --global user.email "your email"
Type the following to confirm your changes
$git config --list
Close Git Bash with following command
$ exit
Initialize repository in an existing directory
$ git init localpath
Cloning and existing repository
$git clone url
Adding
$git add . (add new files)
$git add -u (update tracking for files that changed names or were deleted)
$git add -A (does both of the previous)
You should do this before committing.
Committing
$git commit -m "message" ("message" is useful description of what you did)
git commit -am "save arezzo files"( This command will add and commit file. git commit -a -m "message" - both do the same thing)
Pushing
Change working directory
$git --git-dir git/dirname status
- Created by same people who developed LINUX
- The most popular implementation of version control today
- Everything is stored in local repositories on your computer
- Operated from the command line
Github.Com is a web based hosting service for software development projects which uses the Git version control system.
Pushing and pulling:
Basic Git commands
$git config --global user.name "your name"
$git config --global user.email "your email"
Type the following to confirm your changes
$git config --list
Close Git Bash with following command
$ exit
Initialize repository in an existing directory
$ git init localpath
Cloning and existing repository
$git clone url
Adding
$git add . (add new files)
$git add -u (update tracking for files that changed names or were deleted)
$git add -A (does both of the previous)
You should do this before committing.
Committing
$git commit -m "message" ("message" is useful description of what you did)
git commit -am "save arezzo files"( This command will add and commit file. git commit -a -m "message" - both do the same thing)
Pushing
$git push
Push an existing repository
$git remote add origin https://github.com/manaliajudiya/R.git
Push an existing repository
$git remote add origin https://github.com/manaliajudiya/R.git
$git push -u origin master
Checking the status of your file
$git status
$git status
Branches
Sometimes you are working on a project with a version being used by many people. You may not want to edit that version.
So you can create a branch with the command
$git checkout -b branchname
To see what branch you are on
$git branch
To switch back to master branch type
$git checkout master
Pull requests
Pull requests
If you fork someone's repository or have multiple branches you will both be working separately. In this case, to merge you changes, you need to send a pull request. This is a feature of github.
$git pull (fetch files from repository, you need to have all files on your computer otherwise there will be error "Updates were rejected. Remote contains work that you do not have locally.")
List files in local git repo
$git rev-parse --show-toplevel
To change top level
$cd ~/dirname
Show current working directory
$git pull (fetch files from repository, you need to have all files on your computer otherwise there will be error "Updates were rejected. Remote contains work that you do not have locally.")
List files in local git repo
$git rev-parse --show-toplevel
To change top level
$cd ~/dirname
Show current working directory
$git ls-files --directory
Change working directory
$git --git-dir git/dirname status