您的位置:首页 > 其它

git使用方法的详细教程

2017-07-20 18:48 417 查看
cd进入到你需要提交到的目标目录下

然后将本地文件cp到当前目录cp /home/zhou/Code/qingstor-sdk-java/docs/template/ ./ -r(-r表示递归)

将本地文件add到目标目录git add 本地文件

提交 git commit -m "commit目的"

最后使用git push提交

创建新分支:git branch name

切换到当前新建分支下:gti checkout name

提交:git push --set-upstream origin name

push错误信息

To git@github.com:Eritic/qingstor-sdk-java.git

 ! [rejected]        update-docs -> update-docs (non-fast-forward)

error: failed to push some refs to 'git@github.com:Eritic/qingstor-sdk-java.git'

hint: Updates were rejected because the tip of your current branch is behind

hint: its remote counterpart. Integrate the remote changes (e.g.

hint: 'git pull ...') before pushing again.

hint: See the 'Note about fast-forwards' in 'git push --help' for details.

使用git push -f进行强制push

git commit --amend  修改branch最开始的commit

git log   打印commit的log message

git rebase -i HEAD~N   commit merge

场景如下:假如我们使用"git add filename,git commit -m " message" ",但是在你push之前需要修改这个file,那么我们此时只需要使用"git commit -amend"然后再退出就好了,这样就会将我们修改的file保存下来,最后push一一下就好
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  git