Git is a free distributed version-control system to track changes in source code. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files.
In this post I have tried to summarize the most important git commands.
https://git-scm.com/docs/git-config
command: git init
https://git-scm.com/docs/git-init
command: git clone <git_url>
https://git-scm.com/docs/git-clone
command: git status
https://git-scm.com/docs/git-status
command: git add .
command: git add -p (for an interactive view of what you've made changes on)https://git-scm.com/docs/git-add
command: git commit - m "commit_description"
https://git-scm.com/docs/git-commit
To upload the changes commited in your repository to remote (git push)
command: git pull/push
https://git-scm.com/docs/git-pullhttps://git-scm.com/docs/git-push
command: git branch
https://git-scm.com/docs/git-branch
command: git checkout <branch_name> (change to the specified branch)
command: git checkout . (discard all changes from your current branch)
https://git-scm.com/docs/git-checkout
command: git stash (store changes in stash)
command: git stash pop (move changes from stash and delete them in stash)
command: git stash apply (move changes from stash and keep them in stash)
https://git-scm.com/docs/git-stash
command: git merge <branch_name>
https://git-scm.com/docs/git-merge
command: git merge <branch_name>
https://git-scm.com/docs/git-reset
command: git remote (to check and list)
command: git remote add <remote_url> (to add a new remote)https://git-scm.com/docs/git-remote
command: git diff
https://git-scm.com/docs/git-diff
command: git log --graph (to see the classic git branch timeline view)
https://git-scm.com/docs/git-log
Would you add any other useful command?
In this post I have tried to summarize the most important git commands.
git config
To set your user name and email in the main configuration file.https://git-scm.com/docs/git-config
git init
To initialise a git repository in the current directory.command: git init
https://git-scm.com/docs/git-init
git clone
To copy a git repository from remote source.command: git clone <git_url>
https://git-scm.com/docs/git-clone
git status
To check the pending changes in the working directorycommand: git status
https://git-scm.com/docs/git-status
git add
To add changes to staging areacommand: git add .
command: git add -p (for an interactive view of what you've made changes on)https://git-scm.com/docs/git-add
git commit
To save changes in the local repositorycommand: git commit - m "commit_description"
https://git-scm.com/docs/git-commit
git push/pull
To update your repository with the changes from remote (git pull)To upload the changes commited in your repository to remote (git push)
command: git pull/push
https://git-scm.com/docs/git-pullhttps://git-scm.com/docs/git-push
git branch
To list all the branchescommand: git branch
https://git-scm.com/docs/git-branch
git checkout
To switch between your branches or to discard all the uncommited changescommand: git checkout <branch_name> (change to the specified branch)
command: git checkout . (discard all changes from your current branch)
https://git-scm.com/docs/git-checkout
git stash
To save changes that you don't want to commit inmediatly.command: git stash (store changes in stash)
command: git stash pop (move changes from stash and delete them in stash)
command: git stash apply (move changes from stash and keep them in stash)
https://git-scm.com/docs/git-stash
git merge
To merge the changes from the specified branch in the current branchcommand: git merge <branch_name>
https://git-scm.com/docs/git-merge
git reset
To set the index to the latest commitcommand: git merge <branch_name>
https://git-scm.com/docs/git-reset
git remote
To check what remote/source you have or add a new remote.command: git remote (to check and list)
command: git remote add <remote_url> (to add a new remote)https://git-scm.com/docs/git-remote
git diff
To review changes before committing a changecommand: git diff
https://git-scm.com/docs/git-diff
git log
To show commit logscommand: git log --graph (to see the classic git branch timeline view)
https://git-scm.com/docs/git-log
Would you add any other useful command?
Comentarios
Publicar un comentario