Github is a plateform to share code with friends, colleagues or any unknows persons.
- it's also used to keep backup of our code.
- github is actually two types free and paid, if you want to keep our code privately then you need to pay , for free account the code will be public anyone can see it and can download the code.
How to start using GitHub for Linux
First thing first, you need to have the GitHub account if not then register yourself on Github ( https://github.com/ ).
commands for GitHub to create, update and download the repository
1- first install git on our Linux system if you don't have.
sudo apt-get install git
navigate to the working directory like cd /var/www/html/drupal-8
Run these below commands to initialize the git & configure it.
git init
git config --global user.name "raj" (here raj is my username)
git config --global user.email "dharmendrait08@gmail.com"
sudo apt-get install git
Configure git directory and pull the code from Github
Run these below commands to initialize the git & configure it.
git init
git config --global user.name "raj" (here raj is my username)
git config --global user.email "dharmendrait08@gmail.com"
git remote add origin https://github.com/Dharmend/drupal-8 (It's my project URL hosted on Github)
That's it, Now the git is initialized on the directory...
git Command | Usage |
---|---|
git status | to know the file status of the git to local repository to github repository |
drush add file_name/folder/. | to add the file to local git repository |
git commit -m "any message for this commit" | commit the files to the staging area which you have changed |
git push origin branch_name | push the code to the git repository |
git checkout branch_name/file_name/directory | To get the code from git repository |
git diff file_name | To get the difference of the code from local repository to git repository |
Comments
Post a Comment