0% found this document useful (0 votes)
6 views

Git Github Session

Uploaded by

kezi2804
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Git Github Session

Uploaded by

kezi2804
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Understanding Git and

GitHub Basics:
Practical Examples for
Beginners
Difference between Git and GitHub

S.No Git GitHub

1. Git is a free open source version GitHub is a developer platform that


control makes developers to create, store,
manage and share their code

2. Installed locally in PCs Hosted in the cloud

3. Git was released in 2005 Github was launched in 2008

4. Git is maintained by Linux Github is maintained by Microsoft

5. Git is a software Github is a service

6. https://git-scm.com/downloads/ https://github.com/
win
Alternatives to GitHub

● GitLab
● Bitbucket
● SourceForge
● Codeberg
● Azure DevOps
● AWS CodeCommit
● Gitea
Git Working
Git Commands and Working with Git Bash
1. git init - to initialize the git repository

2.2.

2. git config --global user.name "abcd" - To configure the user


git config --global user.email "[email protected]"
3. git add - to stage the untracked files to the working directory. Eg: git add . or git add
file_name

4. git remote add origin repo_url - adding the git URL as an alias

5. git status - show the modified files in the working directory with the branch name
6. git commit -m “message”- to save the modified files to the working directory.

7. git push origin source_name - to push the changes in the working directory to remote server.
8. git branch / git branch -a - shows all the available branches in the repository. Active
branch contains * next to it.

4. git remote add origin repo_url

9. git checkout -b branch_name - creates a new branch and switches to newly created branch.

10. git branch - - delete branch_name / git branch -D branch_name - deletes the branch.
11. git checkout branch_name / git switch branch_name - switches to another branch and
check it out into your working directory

12. git merge branch_name - merge the specified branch’s history into the current one
13. Git pull / git pull origin branch_name - fetch and merge any commits from the tracking
remote branch

14. git diff - difference of what is changed but not staged


15. git log - displays the list of commit history.

16. git diff branchB branchA - To compare branchA against branchB and see the changes that
are in branchA but not in branchB.
17. git reset filename - unstage a file while retaining the changes in working directory.

18. git clone url - to clone the remote repository (project) to the local environment( machine) .
19. git reset –hard commit_id -it tries to delete the wrongly committed changes in remote repo
and points to previous commit id.

20. git clone url - to clone the remote repository (project) to the local environment( machine) .
21. git rebase branch_name - apply any commits of current branch ahead of specified one

22. git restore filename - discard the unstaged file from the local directory.

23. git stash- save the modified changes and stage it .


Common Errors in Git
When the git is not initialized / remote origin not added.

Most frequently occurred error (merge conflict) in big projects


If the branch does not exists and we try to switch to that branch following error occurs
Feedback Form :
https://forms.gle/yK3VypuPZNUw5xkW8.

Contact Details :
Name: Shanmuga Priya
Email : [email protected]
Thank You All : )

You might also like