: Most frequently used Git commands :
Completely New repository checkout
$ git clone URL_Repo
For
particular branch checkout from URL:
$ git clone -b Branch_Name URL_Repo
Adding a
file into Git repository
$ create a file by using regular Linux
command
$ git add .
$ git commit -am " adding
file in repo" .
Push
code changes into repository :
$ git commit -am "
updating file in repo" .
$ git push/pull
origin Branch_name
Delete a
branch from repository :
$ cd directory_location
$ git push origin --delete
Branch_name
Get/checkout
the updated changes from repositary :
$ git pull origin Branch_Name
Switching
to different branch for code changes :
$ git checkout Branch_name
List the
staus of the repository files :
$ git ls-files --stage
To
delete Branch from git repo:
$ git push --delete origin Branch_name
Branch
Merging : Branch_x merging to other branch_z or Master
$ git check out branch_z
$ git merge branch_x
$ git push origin branch_z
Note : replace branch branch_z with master for merging into master branch
Git Log information more below:
git log
git log -3
git log -p -2
git log --stat
git log --pretty=format:"%h - %an, %ar :
%s"
git log --pretty=format:"%h %s"
--graph
git reflog |
awk '{ print $1 }' | xargs gitk
git log --oneline --all --graph
--decorate $(git reflog | awk '{print
$1}')
git log --reflog
git fsck --lost-found
git log --graph --oneline --decorate
git log --pretty=format:"%cn committed %h
on %cd"
git log --after="2015-7-1"
git log --after="2015-6-1"
--before="2016-7-4"
git log --after="yesterday"
git log --author="srpatcha"
git log --author="srpatcha\|jhon"
git log --grep="JRA-224:"
git log – File_name.cpp
git log -S"update"
git log --merges
git log --no-merges
git log --oneline | nl -v0 | sed 's/^
\+/&HEAD~/'
git log - - oneline – 6
git log --oneline -20 --decorate
git log --pretty="%h - %s" --author=srpatcha
--since="2008-10-01"
git log --since="2 weeks ago"
git log --since="2016-2-18" --pretty=format:" %an, %ar : %s" --all
Thank you for watching post please Like or comment your input review and follow this blog.
No comments:
Post a Comment