sh 有用的git命令

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 有用的git命令相关的知识,希望对你有一定的参考价值。

log/diff --stat
	# diagram of changes per file

log/diff --shortstat
	# count of changes

log --oneline
	# sha + commit messages
	
shortlog
	# commit messages
  
shortlog -s
	# commit count per author
	

branch <branch-name>
	# create new branch

checkout -b <branch-name>
	# create new branch and move to it

fork
	# Create your own copy of a repo
	# push changes to your fork before creating a pull request
	
clone
	# Pull repo to new directory (or remote -> local)

fetch
	# get latest changes from origin, don't merge
	
fetch upstream
  # sync with upstream repo

checkout master
  # ready to sync
  
merge upstream/master
  # merge upstream repo into local files
  
rebase master
  # if upstream adds new commits
	
git pull
	# fetch  + merge
	
git push
	# push changes to origin
	
git push -u origin <branch_name>
	# link local branch to existing repository

git remote
	# add connection to original repository to pull down changes
	


reset
	# unstage, keep changes

reset --hard
	# back to last commit
	
reset --hard origin/master
	# reset to remote repository

------
To merge branches:
  
git checkout <branch>
git merge master

git checkout master
git merge <branch>

------
To Upload:

git push gdi master

以上是关于sh 有用的git命令的主要内容,如果未能解决你的问题,请参考以下文章

sh 有用的Git命令

sh 有用的git命令

sh 一些有用的git命令。

sh git配置有用的别名

sh 有用的NVM命令

sh 有用的命令