Either you are a proffessional coder, or you are newbie to programming, either you use Git every day long or you have recently explored it and now you’re finding it very helpful – definitly you have faced up with need to know some basic package of most often used Git commands.
So here there are some kind of generalisation of the most wide used Git commands, which, we hope, you might find useful for you in your every day workflow.
TELL GIT WHO YOU ARE
Configure the author name to be used
with your commits
CREATE A REPOSITORY
Create a new local repository from scratch
Add one or more files to staging (index)
CHECK OUT A REPOSITORY
Create a working copy of a local repository
For a remote server, use
CHECK THE STATUS
List the files you've changed and those you still need to add or commit
WORK WITH BRANCHES
Create a new branch and switch to it
Switch from one branch to another
List all the branches in your repo, and also tells you what
branch you're currently in
List all local and remote branches
Delete the feature branch
Push the branch to your remote repository, so others can use it
Push all branches to your remote repository
Delete a branch from your remote repository
UPDATE FROM THE REMOTE REPOSITORY
Fetch and merge changes on the remote server to your working directory
Fetch and rebase changes on the remote server to your working directory
To merge a different branch into your active branch
View all the merge conflicts
View the conflicts against the base file
Show changes staged for commit (i.e., difference between index and last commit)
Show changes (staged and unstaged) in working directory since last commit
Preview changes between commits, before merging
After you have manually resolved any conflicts, you mark the changed file
FILE AND DIRECTORY CONTENTS
Show contents of file (specified relative to the project root) from revision rev
Show all tracked files (“-t” shows file status)
Show all untracked files
Remove all untracked files from working copy
Remove all untracked files and directories from working copy
Remove all untracked and ignored files from working copy
Remove all untracked and ignored files and directories from working copy
Commit changes to head (but not yet to the remote repository)
Commit changes made to all tracked files since the last commit,
optionally using commit message msg
Re-commit previous commit, including file1, file2, etc., using previous commit message or,
optionally, a new one given by msg
Send changes to the master branch of your remote repository
CONNECT TO A REMOTE REPOSITORY
If you haven't connected your local repository to a remote server, add the server to be able
to push to it
Adds a remote named remote for the repository at url
Remove reference to remote repository named remote: all tracking branches and
configuration settings for remote will be removed
List all currently configured remote repositories
UNDO LOCAL CHANGES
If you mess up, you can replace the changes in your working tree with the last content in head
Changes already added to the index, as well as new files, will be kept.
Instead, to drop all your local changes and commits, fetch the latest history from the server
and point your local master branch at it, do this
Either unstage file, keeping the file changes
WORK WITH TAGS
You can use tagging to mark a significant changeset, such as a release
CommitId is the leading characters of the changeset ID, up to 10, but must be unique.
Get the ID using
Show recent commits, most recent on top, with full differences
Push all tags to remote repository
SEARCHING FOR CONTENT
Search working tree for text matching regular expression regexp
SEARCHING LOGS AND COMMIT HISTORY
Search commit logs for lines of text matching regular expression regexp
Save your local modifications to a new stash, and run “git reset –hard” to revert them.
This is the default action when no subcommand is given
List all current stashes
Restore the changes recorded in the stash on top of the current working tree state
Remove a single stashed state from the stash list and apply on top of the current
working tree state
Remove all the stashed states
Show who authored each line in file
Show who authored each line in file as of rev (allows blame to go back in time)
AND OF COURSE…
You can always use Git help
Getting an e-Commerce website online might sound like a huge undertaking,...
WebView displays web pages. But we are interested not only in web-content...
Google Maps is a very famous and helpful service, which firmly entrenched...
RSpec is an integral part of Test Drive Development (TDD) and its main id...
When developing a web application that extensively works with user input ...
Field configuration defines behavior of all standart (system) fields and ...
As you might have already heard, the latest stuff for upgrading rails was...