Introduction git
-
Upload
dian-sigit-prastowo -
Category
Technology
-
view
74 -
download
0
Transcript of Introduction git
![Page 1: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/1.jpg)
GIT IntroductionVersion Control System
Dian Sigit Prastowo & Agastyo Satriaji Idam
![Page 2: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/2.jpg)
Problem
![Page 3: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/3.jpg)
Version Control System“A version control system (sometimes called revision control) is a tool that lets you track the history and attribution of your project files over time (stored in a repository), and which helps the developers in the team to work together. Modern version control systems help them work simultaneously, in a non-blocking way, by giving each developer his or her own sandbox, preventing their work in progress from conflicting, and all the while providing a mechanism to merge changes and synchronize work.”
“Mastering Git.”
![Page 4: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/4.jpg)
Version Control System
![Page 5: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/5.jpg)
What is GIT?Git is Distributed Version Control System
“Distributed means that there is no main server and all of the full history of the project is available once you cloned the project”
![Page 6: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/6.jpg)
A Brief History• In 2002, the Linux kernel project bega using a
DVCS calld BitKeeper.• In 2005, the commercial company that
developed BitKeeper broke down, and the tool’s free-of-charge status was revoked.
• This prompted the Linux development community (and in particular Linux Trovalds, the creator of Linux) to develop their own tool - GIT
![Page 7: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/7.jpg)
First of all, definitions • Working tree
A directory in your filesystem that is associated with a repository, containing files & sub-directories• Repository
A collection of commits & branches, saved in the .git directory• Commit
A Snapshot of your working tree at a certain point in time, identified by a revision number.• HEAD
The name for the commit thats currently checked out in.
![Page 8: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/8.jpg)
GIT• You can imagine git as something that
sits on top of your file system and manipulates files.
• This “something” is a tree structure where each commit creates a new node in that tree.
• Nearly all git commands actually serve to navigate on this tree and to manipulate it accordingly.
![Page 9: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/9.jpg)
GIT CommandsVersion Control System
Dian Sigit Prastowo & Agastyo Satriaji Idam
![Page 10: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/10.jpg)
Commands• git config
• git init
• git add
• git rm
• git commit
• git log
• git diff
• git status
• git reset
• git branch
• git checkout
• git merge
• git remote
• git clone
• git push
• git pull
![Page 11: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/11.jpg)
Install Git on Windows
• Download the latest Git for Windows installer git
• Started the installer, you should see the Git Setup wizard screen. Follow the Next and Finish prompts to complete the installation.
• Open a Command Prompt (or Git Bash if during installation you elected not to use Git from the Windows Command Prompt).
• Run the following commands to configure your Git username and email using the following commands:
$ git config --global user.name “Dian Sigit”$ git config --global user.email "[email protected]”
![Page 12: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/12.jpg)
Configuration
![Page 13: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/13.jpg)
Local Repositorygit init
git-init - Create an empty Git repository or reinitialize an existing one
![Page 15: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/15.jpg)
Local Repositorygit rm
git-rm - Remove files from the working tree and from the index
![Page 16: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/16.jpg)
Local Repositorygit commit
git-commit - Record changes to the repository
![Page 17: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/17.jpg)
Local Repositorygit commit
git-commit - Record changes to the repository
![Page 19: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/19.jpg)
Local Repositorygit diff
git-diff - Show changes between commits, commit and working tree, etc
![Page 20: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/20.jpg)
Local Repositorygit status
git-status - Show the working tree status
![Page 21: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/21.jpg)
Local Repositorygit reset
git-reset - Reset current HEAD to the specified state
![Page 22: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/22.jpg)
Local Repositorygit branch
git-branch - List, create, or delete branches
![Page 23: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/23.jpg)
Local Repositorygit checkout
git-checkout - Switch branches or restore working tree files
![Page 24: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/24.jpg)
Local Repositorygit merge
git-merge - Join two or more development histories together
![Page 25: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/25.jpg)
Installing SSH keys on Windows
• To access your Git repositories you will need to create and install SSH keys
• Generating a key pair, ssh-keygen -t rsa• Copy the public key, and paste on gitlab SSH Key
Settings, cat ~/.ssh/id_rsa.pub | clip• Checking your connection, ssh [email protected]
![Page 26: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/26.jpg)
Collaboration Repositorygit remote
git-remote - Manage set of tracked repositories
![Page 27: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/27.jpg)
Collaboration Repositorygit clone
git-clone - Clone a repository into a new directory
![Page 28: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/28.jpg)
Collaboration Repositorygit push
git-push - Update remote refs along with associated objects
![Page 29: Introduction git](https://reader036.fdocuments.net/reader036/viewer/2022062523/58efb8421a28ab1c0a8b4675/html5/thumbnails/29.jpg)
Collaboration Repositorygit pull
git-pull - Fetch from and integrate with another repository or a local branch