Monday, September 10, 2018

How Git works


1. Create a "repository" with hosting tool (GitHub)
Note: Use Github for creating repository - https://github.com/nidhisht/MyFirstRepository
2. Clone (copy) repository to your local machine
$git init
$git clone https://github.com/nidhisht/MyFirstRepository
3. Add a file to local repository and "commit" (save) changes
$git commit -a
4. "Push" your changes to master branch
$git push
5. Change the file in hosting tool and "commit"

6. "Pull" changes to your local machine
$git pull

Reference: https://www.atlassian.com/git

Example:
git init
git clone https://github.com/nidhisht/SampleRepository.git
git add .
git commit -m "first commit"
git push origin master

No comments: