0% found this document useful (0 votes)
7 views5 pages

Git B10

The document provides a comprehensive guide on essential Linux and Git commands, including user configuration, repository management, branching, and stashing. It also covers command usage for file manipulation, version control operations, and basic text editing with VIM/VI. Additionally, it discusses advanced Git concepts like merging, rebasing, and pull requests.

Uploaded by

Rakesh Mirchi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views5 pages

Git B10

The document provides a comprehensive guide on essential Linux and Git commands, including user configuration, repository management, branching, and stashing. It also covers command usage for file manipulation, version control operations, and basic text editing with VIM/VI. Additionally, it discusses advanced Git concepts like merging, rebasing, and pull requests.

Uploaded by

Rakesh Mirchi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

=========================

LINUX COMMANDS:

pwd
touch <filename>
touch file1 file2 file3
cat filename
rm -rf filename
ls
ll
ls -lrth
ls -la

clear or ctrl + L
---------------------------------------------------------
mkdir dir1 dir2 dir3
cd dir1
cd ..
rm -rf dir1

=========================
GIT COMMANDS:
user configuration :

git config --global user.name "kiran"

git config --global user.email "[email protected]"

git config --list

----------------------------
git init ---> To initialize a empty repo
git status
touch file1
git status --> Red , UT

git add file1


git status --> Green .

git commit -m "msg" file1


git log ---> CID

-----------------------------------
git reset HEAD fname ---> staging to WS

git reset --soft cid (n-1) ----> LR to Staging

git reset --mixed cid (n-1) ----> LR to Workspace


----------------

git clone https://github.com/devopstraininghub/batch10.git

mailid
pwd

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

------------
git clone https://github.com/devopstraininghub/batch10.git

cd batch10
touch name
git status
git add .
git commit -m "name"
git push ---> errorcode
git pull --rebase
git push

===========
BRANCH :

git branch

git branch <Br.name>


git checkout <br.name>
--------

git checkout -b <br.name>

git branch
-
--
--
git push origin <br.name>

git push https://github.com/devopstraininghub/batch10.git <br.name>

===========
git branch -d <br.name>

git branch -D <br.name>


=======
git push origin -d <br.name>

==========

git cherry-pick

-------------
linux :

vi or vim / nano

VIM/ VI editor:
--
vim file3
--------
esc i --- > insert mode
....
.... xyz
....
esc :w
esc :q
or
esc :wq
or
esc :wq!
==========

FILTERING:

git log --oneline


git log --oneline -n
git log --author kiran
git log --since "19-12-2022"

===================

TAG :

git tag

git tag <tag.name>


git checkout <tag.name>

git push origin <t.name>

git tag -d <t.name>

git push origin -d <t.name>

===========
================

amend
-----
git commit --amend -m "label" -m "label2" -m "label3"

============
==============================
Alias
-----
git status

git config --global alias.ss "status"

git config --global alias.s "status"


git config --global alias.s "status"
git s

git log
git config --global alias.l "log"
git l

git log --oneline


git config --global alias.lo "log --oneline"
git lO

======

=========
git stash list
git stash save "label"

git stash show stash@{x}

POP, APPLY, DROP


-----------------
POP - cut
----
git stash pop

APPLY - copy
------
git stash apply

DROP - delete
-----
git stash drop

---------------------
.git/refs/stash

=========
.gitignore

=======================

git merge vs git rebase

git log --oneline


c40a50e (HEAD -> rel) to fix ac issue Merge branch 'master' into rel
8cb561e (master) m3
c88b68b r3
5ef952e m2
0f5926f r2
26e91e6 m1
9a9b076 r1
7cf033c xyz

----------

============================
git pull vs git fetch

========================

git pull -- git fetch + git merge origin


git pull --rebase

==============================
revert
------
git revert cid

profile

===============================

PR (Pull Requests)
protecting main branch
fork - open source project contribution
Interview questions
-- AWS free tier account
--------------------------------

You might also like