GIT & GITHUB
GIT & GITHUB (Basics)
=======================================================================git --version |<to check your git version>
=======================================================================
BASIC COMMANDS OF LINUX(required) : "ls,cd,touch,mkdir,ll,grep,mv,cp,cat" etc.... use manual page in terminal to get info.
=======================================================================
git config This command sets the author name and email address respectively to be used with your commits
Tell GIT that who you aregit config --global user.name "Srinivas"
git config --global user.email Sriki@example.com
git init This command is used to start a new repository
git init [repository name] |<create .git file to work as version control> to create local repo========================================================================
git clone This command is used to obtain a repository from an existing URL
git clone [url] =======================================================================
git add This command adds a file to the staging area
git add [file] |<to add file to git>
git add *
git add . |<to add files to staging env>
=======================================================================
git commit This command records or snapshots the file permanently in the
version history.
git commit -m "message" |<to commit work done>
git commit -a=======================================================================
git diff This command shows the file differences which are not yet staged
git diff [first branch] [second branch] |<to check diff>
git diff –staged
git diff --base <filename>
git diff <source> <target>
======================================== ===============================
git reset This command unstages the file, but it preserves the file contents
git reset --hard HEAD |<to move the current HEAD to the commit specified>
git reset [file]
git reset [commit] |<here commit is log>
git reset –hard [commit]
========================================================================
git status This command lists all the files that have to be committed
========================================================================
git rm This command deletes the file from your working directory and stages the deletion.
========================================================================
git log This command is used to list the version history for the current branch
git log –follow[file]
========================================================================
git show This command shows the metadata and content changes of the specified commit.
git show [commit] |<here commit is log>
=======================================================================
git tag This command is used to give tags to the specified commit.
git tag [commitID]
========================================================================
git branch This command lists all the local branches in the current repository
git branch [branch name] |<to show all the branches>
git branch -a |<to show all the branches>
git branch -d [branch name] |<to delete branch>
git branch branchname |<to create new branch> branch is used to maintain diff versions of commits>
git merge branchname |<to merge with existing branch>
git branch -m [old] [new] |<to overwrite branch name>
========================================================================
git checkout This command is used to switch from one branch to another
git checkout -b [branch name] |<create branch and switch to it>
git checkout [branch name]
git checkout HEAD branchname |<navigate between the branches created by git branch>
git checkout master |<switch to master branch>
========================================================================
git merge This command merges the specified branch’s history into the current branch.
git merge [branch name]
========================================================================
git remote This command is used to connect your local repository to the remote server.
git remote add [variable name] [remote server link]========================================================================
git push This command sends the committed changes of master branch to your remote repository
git push --all origin |<push to remote repository>
git push [variable name] master |<variable = origin ex.>
git push [variable name] [branch]
git push –all [variable name]
git push [variable name] :[branch name]
========================================================================
git pull This command fetches and merges changes on the remote server to your working directory
git pull [Repo Link] |<to pull from repo>
========================================================================
git stash This command temporarily stores all the modified tracked files
git stash save
git stash pop
git stash list
git stash drop
=======================================================================
TRY++
MORE:
=======================================================================
git clone --mirror <URL> .git |<to clone all the branches make sure to create directory>
git config --bool core.bare false
git reset --hard
=======================================================================
git clone -b <branchname> <url> |<to clone specific branch from github>
=======================================================================
TO START:
rm -dfr .git |<start as fresh and remove .git file>

git logs
git add .
git commit -m " new folder"
git status
===================================
Thank you i hope it might be useful for you........
This Blog was really good & helpful..
ReplyDelete