HOW TO Use GITHUB & BASIC GitHub CommandS.
Git and GitHub Introduction
What is Git?
Git is a popular version control system. It was created by Linus Torvalds in 2005 and has been maintained by Junio Hamano since then.
It is used for:
- Tracking code changes
- Tracking who made changes
- Coding collaboration
A. Git Basic Commands
‘’ 15 basic git commands you should know’’
- Git config
Git config One of the most widely used git config, which can be used to set certain configurations according to the user’s wishes, such as email, an algorithm for diff, username, file format, etc. for example, the following command can be used to set up email:
git config --global user.email danialvaro001@gmail.com
2. Git init
This command is used to create a new repository. the method:
git init
3. Git add
The git adds command can be used to add files to the index. For example, the following command it will add a file named temp.txt which is in the local directory to index:
git add temp.txt
4. Git clone
The git Clone command is used to check out the repository. if the repository is on the remote server, use:
git clone alex@93.188.160.58:/path/to/repository
If want to make a local repository, use:
git clone /path/to/repository
5. Git commit
The git commit command is used to commit changes to the head. Note that any changes that are committed will not go directly to the remote repository. Use:
git commit -m "Fill in a description for the commit"
6. Git status
The git status command displays a list of changed files along with the files you want to add or commit. Use:
git status
7. Git push
git push is another basic git command. Push will send changes to the master branch of the remote repository that corresponds to your working directory. For example:
git push origin master
8. git checkout
The git checkout command can be used to create branches or to move between them. For example, the following command will create a new branch and move to it:
command git checkout -b <name-branch>
To move from one branch to another, use:
git checkout <branch-name>
9. Git remove
The git remote command will allow the user to connect to the remote repository. The following command will display the repository being configured.
git remote -,v
This command allows the user to connect the local repository to the remote server:
git remote add origin <93.188.160.58>
10 Git branch
The git branch command can be used to list, create or delete branches. To display all the branches in the repository, use:
git branch
To delete a branch:
git branch -d <branch-name>
11. git pull
To merge all changes in the remote repository to the local directory, use the pull command:
git pull
12. Git marge
The git diff command is used to display conflicts. To see conflicts with the base file, use:
git diff --base <name-file>
13. git merge
The merge command is used to merge a branch into the active branch. Use:
git merge <nama-branch>
14. git show
To display information about an object in git, use git show
git show
15. git fetch
This command is used to display all objects from the remote repository that are not in the local working directory. For example:
git fetch origin
=====Conclusion=====
SOME of the discussions above are the most frequently used git commands. Make sure you also check out our other GIT tutorials to learn how to setup and install GIT.