03 - Local Repository - GIT
GIT
- What is VCS (Version Control System) :
- Version Control is a system that documents changes made to a file or a set of files.
- It allows multiple users to manage multiple revisions of the same unit of information.
- It is a snapshot of your project over time
- Git is free and open-source Distributed Version Control Systems (DVCS) which records changes made to the files laying emphasis on Speed, Data Integrity, Distributed Non-linear (Branching) workflows
- 1 - Download GIT for different OS
- Redhat/Centos based OS
- yum install git
- Debian based OS
- apt-get install git
- Windows-based
- https://git-scm.com/download/win
- Install and Configure GIT in Centos
- vagrant ssh
- sudo su -
- hostnamectl set-hostname git.unixcloudfusion.in
- bash
- vi /etc/hosts
- 192.168.33.14 git.unixcloudfusion.in
- yum install git -y ** download git with dependencies
- git --version
- git version 1.8.3.1
- git config --global user.name "Ali M"
- git config --global user.email "alim@yahoo.com"
- mkdir infra-automation
- cd infra-automation
- git init **** Git repository in /root/infra-automation/.git/
- ls -ltra .git/
- 3 - How to use GIT
- vi README This project is for Infra automation
We are going to create a configuration for Infra automation
- git status ** View status of the un-tracking file
- git add README ** Push file to the staging area
- git status ** View status of the staging file
- git commit -m "Added the readme file the project"
- vi README
- git diff ** Show changes in the committed and modified file
- git add README ** Push move new update in the staging area
- git commit -a -m "Add feature 1 and 2"
- touch file1 file2 file3
- get add file1
- rm file1
- git rm file1 or git rm -f file1
- git rm --cached file1 ** remove from git but not removed from the system
- 4 - How to ignore files in the repository
- touch web.jar
- touch app.war
- touch app.jpg
- touch video.mp4
- ** git only track text file
- ** never put binaries in staging and git
- vi .gitignore
*.war
*.jar
*.jpg
*.mp4
- 5 - View all committed
- git log
- git log --online
- git log --online --decorate --graph
- 6 - Add and delete Tag
- git tag --a v1 -m "We are going to release this project"
- git tag
- get show v1
- ** delete tag
- git tag -d vi or git tag --delete v1
Comments
Post a Comment