Git Commands
Git Commands
com
GIT COMMANDS
Solution :
$ git remote rm origin
What is Git ?
Version Control tool (Source Code management Tool)
---
SVN - SubVersion
GIT
SVN GIT
➢ Centralized Repository ➢ Distrubuted Repository
➢ Code Develops at Centrailized Repo ➢ Code Develops at Local Centrailized Repo
➢ Internet is needed always ➢ Only Needed to push code
Downloading Git :-
https://git-scm.com/downloads
Debian/Ubuntu:-
sudo apt-get update
sudo apt-get install git -y
git --version
7013882648 [email protected]
Phases In GIT : -
Link : https://github.com/
Click on sign up and provide the basic details and verify email address
7013882648 [email protected]
Getting code from Github Repository:-
git clone https://github.com/devopsrishi/helloworld.war.git
git add .
git add -A --> use any one command to move all files at a time
git add *
git status
git log
Summary:-
touch file -->git status --> git add file -->git status --> git commit -m “firstcommit” . -->git log --->git show cid
git log -n
Reset Commands
➢ Local to staging ➢ git reset --soft commitid
Note : Local to staging - give Previous commit id to get present one (eg: To get 4th commit id roll back give
3rd commit id)
Branches Concept:-
Master
git log
git log
Come to master
Conflict Errors:-
If we modify same file in two different branches
➢ Under master:-
cat > file1 -->hello --> git add commit -->
Merging now
Automatic merge failed; fix conflicts and then commit the result.
Resolving:-
git merge --abort
vi file1
Stash Memory : -
Default memory available in git i.e stash memory. (Temporary storage of files which is available in staging?index)
Lab:-
git stash list
git status
Status
Alias Commands:-
Alias Command Description
➢ git config –list ➢ list out alias &b user details
➢ git config --global alias.l "log" ➢ Configuring alias command for log
➢ git config --global alias.b "branch" ➢ Alias command for branch
➢ git config --global alias.l1 "log --oneline" ➢ Alias command for gilt log --oneline
Removing Username
➢ git config --global --unset user.name
Removing Alias
➢ git config --global --unset alias.b
Lab:-
touch file --> git add file --> git commit -m “file” .
Rushi
Rohith
Now try to add these files and modify this it wont show in status.
7013882648 [email protected]