Git and Github
Muhammad Anas
β @ MLSA | Ex Inter @ CodSoft, BharatIntern | MERN Stack | JavaScript | React.js | Node.js | Express.js | MongoDB | Material UI | Graphic Design | UE-IT Society Graphics Team Member, Marketing
Hi all readers hope you are doing well.
In this article I will talk about what is Git & Github. So as a human, mistakes can be happen. SO if you find any mistake, let me know as you got any mistake
Many of the People thought that Git and Github are the same things, But actually there is muc difference between them.I will try to explain as simple as I can.
First of all what is GIT???
Git:
Git is a distributed version control program that manages and keep track of any changing in your surce code.It is also useful for the programmers to work collaboratively during the development of software.
Git is a computer program that we install in our system and connect with it by the specified commands
Git Hub:
?GitHub is a hosting plateform that can host the repositories created by the git. We can easily get source code of our project from any corner of world by the means of GitHub.
So it is clear that we can create and keep track of history of our source code and we can host that code of any software on GitHub website. And we can access that source code from any device and we can share our source code with any one.
Git's commands are similar to Linux because the founder of linux and git is Sir LINNUS TORVALDS.
Here are the some of the basic commands that we use in our GitBash.
$ git config:
???????The first thing you should do when you install Git is to set your user name and email address. This is important because every Git commit uses this information, and it’s immutably baked into the commits you start creating.
?$ git config --global user.name "Anas Raza"
?$ git config --global user.email [email protected]
These are the two main commands to config any git.Note that you have to do config only once when you install git.
2. $ git init:
??????This command is used for initialize an empty git repository.
3. $ git status:
???????Git status command displays the status of working directory and the staging area. It tells that which changes have been staged and which are not, which files are on tracking and which files are not under tracking, however it not tells about commited history.
4. $ git commit -m "":
??????????This command is used for commit any changes you made.
?5. $ git log:
?????It displays all of the commits that have made in a repository.
6. $ git add .:
??????This command is used to stage all files that are in working directory
领英推荐
7. $ git reset:
??????To hard reset files to HEAD on Git, use the “git reset” command with the “–hard” option and specify the HEAD. The purpose of the “git reset” command is to move the current HEAD to the commit specified?
$ git --hard HEAD
8. $ git reset (commit):
?????????This command undoes all the commits after the specified commit and preserves the changes locally.
9. $ git diff:
??????This command is used to differentiate between staged files and working directory.
10. $ git diff branch1 branch2:
???????????This command shows the difference between that two branches.
11. $ git branch:
???????This command will lists all of the present branches.
12. $ git checkout -b anas:
???????This will create new branch named anas and swithed into it.
13. $ git checkout main:
?????????This command will move you into main branch.
14. $ git merge (branch name):
????????????This will merge specified branch to current branch.
15. $ git rm filename:
????????This command deletes the file from your working directory and stages the deletion.
16. $ git show (commit full name):
??????????????This command will show you the full info of that specified commit.
17. $ git remote:
??????This command will connect your local repo to remote repository.like;
?????????$ git remote add origin [email protected]:anasgee/anas-tech-tube.git
18. $ git push -u origin main:
????This command is used to push your source code to remote directory.
19.$ git pull:
????This command is used to pull code from remote server to local directory or repository.
Hurrah:
? ??Great:
?????? Fabulous;
You are now Git And GitHub expert.
SWE @ Calo | React | React Native | Node | JS | TS | AWS | Serverless
2 年Great work...Keep sharing ??