Before going to What are git and GitHub commands first we go to what is git and Github and how to install git.
What is Git?
By far, the most widely used modern version control systems in the world are Git. Linus Torvalds, the famous creator of the Linux operating system kernel. A number of software projects rely on Git for version control, including commercial projects as well as open-source.
Having a distributed architecture, Git is an example of a DVCS (Distributed Version Control System). Rather than having only one single place for the full version history of the software as is common in the once-popular version control systems like CVS or Subversion (also known as SVN) in Git, every developer’s working copy of the code is also a repository that can contain the full history of all changes. In addition to being distributed, Git has been designed with performance, security, and flexibility in mind.
What is GitHub?
GitHub is a code hosting platform for collaboration and version control. GitHub lets you (and others) work together on projects.
GitHub essentials are:
- Pull Requests
- Git (the version control software GitHub is built on)
1: Install git and create a GitHub account
The first two things you’ll want to install git and create a free GitHub account.
Follow the instructions here to install git (if it’s not already installed). Note that for this tutorial we will be using git on the command line only. While there are some great git GUIs (graphical user interfaces), I think it’s easier to learn git using git-specific commands first and then to try out a git GUI once you’re more comfortable with the command.
Once you’ve done that, create a GitHub account here. Accounts are free for public repositories, but there’s a charge for private repositories.)
What are git and GitHub and it
1. Create a new repository.
Create a new repository on GitHub. To avoid errors, do not initialize the new repository with README, license, or files. You can add these files after your project has been pushed to GitHub.
2. Open Git Bash.
3. Change the current working directory to your local project.
Means make a directory anywhere. Paste the path of that directory into bash.
To do that write in bash
$ cd ” path-name “
4. Initialize the local directory as a Git repository.
$ git init
5. Add a File in that Folder directly or by $touch <filename>
command. You can display a file by using $ls command.
6. Connect through the GitHub site.
7. Add a file into the repository with git and github commands.
Add a file by using ” $git add <file-name> ” for a single file.
8. You can view the status of a file in Github.
9. Delete a file into the repository.
$ git rm –cached <file-name>
10. Modify the file.
When you modify the file, come to bash and type git status in this you can see the modified file.
When you modified the file, then always adds that file by using “$ git add ” command.
Then after committing the file changed file using “ $git commit -m ‘Changed <file-name>’ ”
When nothing to commit appear to mean you commit the file.
11. Add a folder file.
In the first command, you can see a file and folder in blue.
And a folder contains each file. To add a file using the command $git add
In status, you can see the new files. Then commit the files by the command “$ git commit -m ‘another Changed’ “
12. Add username and email.
13. Push an existing repository on GitHub from the command line.
Go to the repository on Github.
In bash type, $ git remote add origin <you repository path>
Then type $git push origin master. In case if not working, then type $ git push –set-upstream origin master
Fill this then after you can see your directory on GitHub.
Please write comments if you find anything incorrect in git and github commands, or you want to share more information about the topic discussed above.
Also view:- How to remove Personalisation Ads?