Git - Is software keeeping track of changes . it is version control and comapre the different versions.
manage source code .
Here are some commands -
git config
Utility : To set your user name and email in the main configuration file.
How to : To check your name and email type in git config --global user.name and git config --global user.email. And to set your new email or name git config --global user.name = “” and git config --global user.email = “”
git init
Utility : To initialise a git repository for a new or existing project.
How to : git init in the root of your project directory.
Utility : To set your user name and email in the main configuration file.
How to : To check your name and email type in git config --global user.name and git config --global user.email. And to set your new email or name git config --global user.name = “” and git config --global user.email = “”
git init
Utility : To initialise a git repository for a new or existing project.
How to : git init in the root of your project directory.
git clone
Utility : To copy a git repository from remote source, also sets the remote to original source so that you can pull again.
How to : git clone <:clone git url:>
git status
Utility : To check the status of files you’ve changed in your working directory, i.e, what all has changed since your last commit.
How to : git status in your working directory. lists out all the files that have been changed.
git add
Utility : adds changes to stage/index in your working directory.
How to : git add .
Utility : To copy a git repository from remote source, also sets the remote to original source so that you can pull again.
How to : git clone <:clone git url:>
git status
Utility : To check the status of files you’ve changed in your working directory, i.e, what all has changed since your last commit.
How to : git status in your working directory. lists out all the files that have been changed.
git add
Utility : adds changes to stage/index in your working directory.
How to : git add .
git commit
Utility : commits your changes and sets it to new commit object for your remote.
How to : git commit -m”sweet little commit message”
Utility : commits your changes and sets it to new commit object for your remote.
How to : git commit -m”sweet little commit message”
git push/git pull
Utility : Push or Pull your changes to remote. If you have added and committed your changes and you want to push them. Or if your remote has updated and you want those latest changes.
How to : git pull <:remote:> <:branch:> and git push <:remote:> <:branch:>
Utility : Push or Pull your changes to remote. If you have added and committed your changes and you want to push them. Or if your remote has updated and you want those latest changes.
How to : git pull <:remote:> <:branch:> and git push <:remote:> <:branch:>
git branch
Utility : Lists out all the branches.
How to : git branch or git branch -a to list all the remote branches as well.
Utility : Lists out all the branches.
How to : git branch or git branch -a to list all the remote branches as well.
git checkout
Utility : Switch to different branches
How to : git checkout <:branch:> or **_git checkout -b <:branch:> if you want to create and switch to a new branch.
Utility : Switch to different branches
How to : git checkout <:branch:> or **_git checkout -b <:branch:> if you want to create and switch to a new branch.
git stash
Utility : Save changes that you don’t want to commit immediately.
How to : git stash in your working directory. git stash apply if you want to bring your saved changes back.
git merge
Utility : Merge two branches you were working on.
How to : Switch to branch you want to merge everything in. git merge <:branch_you_want_to_merge:>
Utility : Save changes that you don’t want to commit immediately.
How to : git stash in your working directory. git stash apply if you want to bring your saved changes back.
git merge
Utility : Merge two branches you were working on.
How to : Switch to branch you want to merge everything in. git merge <:branch_you_want_to_merge:>
git reset
Utility : You know when you commit changes that are not complete, this sets your index to the latest commit that you want to work on with.
How to : git reset <:mode:> <:COMMIT:>
Utility : You know when you commit changes that are not complete, this sets your index to the latest commit that you want to work on with.
How to : git reset <:mode:> <:COMMIT:>
git remote
Utility : To check what remote/source you have or add a new remote.
How to : git remote to check and list. And git remote add <:remote_url:>
git commit -am
Utility : To check what remote/source you have or add a new remote.
How to : git remote to check and list. And git remote add <:remote_url:>
git commit -am
Utility: To commit and add together
How to : git commit -am "message"
git diff
Uitility - to check the difference between two branches or check difference between working directory and staging area
how to: git diff master..newbranch
git diff
git diff --staged
Utility- To check difference between staging area and repository '
Howe to : git diff --staged
git restore
Utitlity - restore the cjhanges which are in staging area
How to: git --restore file1
git-reset - Reset current HEAD to the specified state
git reset HEAD filename - to reset to working directory from staging area .
git reset [-q] [<tree-ish>] [--] <pathspec>… git reset [-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>] git reset (--patch | -p) [<tree-ish>] [--] [<pathspec>…] git reset [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] [<commit>]
--soft
Does not touch the index file or the working tree at all (but resets the head to <commit>, just like all modes do). This leaves all your changed files "Changes to be committed", as git status would put it.--mixed
Resets the index but not the working tree (i.e., the changed files are preserved but not marked for commit) and reports what has not been updated. This is the default action.
If -N is specified, removed paths are marked as intent-to-add (see git-add[1]).--hard
Resets the index and working tree. Any changes to tracked files in the working tree since <commit> are discarded.
git show SHA - to get the details related to that SHA
git rm filename - to delete a file
git mv file 1 file 2 - to rename a file name
git commit amend -m "chnge the commit"- if you want to change in the commit
git revert - to revert the commit
git revert shaname
git branch -m branchnamenew - for rename a branch name
git branch -d branchname
No comments:
Post a Comment
Please let me know if you have any doubts.