`
iwelcomeyou
  • 浏览: 16832 次
社区版块
存档分类
最新评论

Git命令总结

    博客分类:
  • Git
阅读更多
git 配置 当前用户:~/.gitconfig 通过git config --global进行配置

git config --global user.name "userName"
git config --global user.email "userName@gmail.com"
git config --global color.ui "auto" 
git config --global color.diff "auto" 
git config --global color.status "auto" 
git config --global color.branch "auto"
git config --global core.editor "nano"

git config --global --list进行查看当前用户的配置

git pull --rebase origin develop
git push origin develop
git commit -am "Resolved merge conflicts."
git commit -am "Bug 10507: fixed UI issue in selfservice where modal did not close correctly"
git merge --no-ff
git clone
git checkout --track origin/branchName

git remote prune origin :To refresh local branch list then I need to prune my branches list.
git reset --soft HEAD^ :Undo a commit
git push -u origin localBranchName

git config --global core.excludesfile ~/.gitignore_global


git init - initializing a repository in an existing directory
git clone [url] / git clone [url] targetdirectoryname - cloning an existing repository
git status - checking the status
git add [filename]/[directoryname] - tracking new files / staging files / if you modify a file after you run git add, you have to run git add again to stage the latest version of the file
git diff - to see what you’ve changed but not yet staged
git diff —staged - to see what you’ve staged that will to into your next commit
git commit -m “commit message” - to commit the staged files
git commit -a -m “commit message” - automatically stage files and commit
git rm “filename” - remove files
git rm —cached “filename” - keep the file in working tree but remove it from your staging area
git mv file_from file_to - rename a file
git commit —amend
git reset HEAD <file>
git remote add [shortname] [url] - to add a new remote git repository as a shortname
git fetch [remote-name] - to get data from your remote projects
git push [remote-name] [branch-name] - to push your work back up to the server
git tag - to list the available tags in git
git tag -l ‘v1.4.*’ - to search for tags with a particular pattern
git tag -a v1.4 -m ‘my version 1.4’ - to create an annotated tag
git show v1.4 - to see the tag data
git branch [branch-name] - to create a new branch
git branch -d [branch-name] - to delete a branch
git checkout [branch-name] - to switch to another branch
git checkout -b [branch-name] - to create and switch to a new branch
git fetch [remote reference] - to update your remote references
git push (remote) (branch) - to push your local branch to a remote
git checkout -b (branchname) origin/(remotebranchname) - to give you a local branch that you can work on that starts where origin/(remotebranchname) is
git push [remotename] :[remotebranch] - to delete remote branch
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics