git使用

git push
push 当前分支遇到报错:

[atom_guoyanan@kdd7224 project_recognize]$ git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

Username for 'https://gitlab.ifchange.com': yanan.guo@ifchange.com
Password for 'https://yanan.guo@ifchange.com@gitlab.ifchange.com':
To https://gitlab.ifchange.com/nb4/project_recognize.git
 ! [rejected]        shujuan -> shujuan (non-fast-forward)
error: failed to push some refs to 'https://gitlab.ifchange.com/nb4/project_recognize.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. If you did not intend to push that branch, you may want to
hint: specify branches to push or set the 'push.default' configuration variable
hint: to 'simple', 'current' or 'upstream' to push only the current branch.

## 解决
[atom_guoyanan@kdd7224 project_recognize]$ git config --global push.default simple
[atom_guoyanan@kdd7224 project_recognize]$ git push
Username for 'https://gitlab.ifchange.com': yanan.guo@ifchange.com
Password for 'https://yanan.guo@ifchange.com@gitlab.ifchange.com':
Everything up-to-date

git merge
将其他分支merge到当前分支:

[atom_guoyanan@kdd7224 project_recognize]$ git checkout guoyanan
Switched to branch 'guoyanan'
[atom_guoyanan@kdd7224 project_recognize]$ git merge develop
CONFLICT (modify/delete): start.sh deleted in develop and modified in HEAD. Version HEAD of start.sh left in tree.
Removing src/recog_pattern.py
Removing src/recog_combine.py
Auto-merging run_server.py
Auto-merging log/dd.log
CONFLICT (add/add): Merge conflict in log/dd.log
Auto-merging log/access.log
CONFLICT (add/add): Merge conflict in log/access.log
Auto-merging docker/requirements.txt
CONFLICT (content): Merge conflict in docker/requirements.txt
Auto-merging docker/Dockerfile
CONFLICT (content): Merge conflict in docker/Dockerfile
Removing conf/redis.yaml
Removing conf/mysql.yaml
Automatic merge failed; fix conflicts and then commit the result.

解决好冲突之后,git add,git commit,再git merge

[atom_guoyanan@kdd7224 project_recognize]$ git merge develop
error: 'merge' is not possible because you have unmerged files.
hint: Fix them up in the work tree,
hint: and then use 'git add/rm <file>' as
hint: appropriate to mark resolution and make a commit,
hint: or use 'git commit -a'.
fatal: Exiting because of an unresolved conflict.
[atom_guoyanan@kdd7224 project_recognize]$ git add docker/Dockerfile
[atom_guoyanan@kdd7224 project_recognize]$ git status
# On branch guoyanan
# You have unmerged paths.
#   (fix conflicts and run "git commit")
#
# Changes to be committed:
#
#	new file:   back
#	modified:   conf/logging.yaml
#	deleted:    conf/mysql.yaml
#	deleted:    conf/redis.yaml
#	new file:   data/vocab.txt
#	new file:   deploy.txt
#	new file:   docker/build_docker.sh
#	new file:   init_service.sh
#	new file:   log/.gitkeep
#	new file:   model/bert_vocab.txt
#	new file:   model/model.config
#	new file:   model/platform.config
#	new file:   model/qalink/1/bert_config.json
#	new file:   model/qalink/1/label.txt
#	new file:   model/qalink/1/saved_model.pb
#	new file:   model/qalink/1/variables/variables.data-00000-of-00001
#	new file:   model/qalink/1/variables/variables.index
#	new file:   model/qalink/1/vocab.txt
#	new file:   resource/merge_rename4.txt
#	new file:   resource/stops.txt
#	modified:   run_server.py
#	new file:   src/app/pattern_lstm_2.py
#	new file:   src/app/recognize.py
#	modified:   src/client.py
#	renamed:    src/model.py -> src/lstm_model.py
#	new file:   src/model/__init__.py
#	new file:   src/model/bert_client.py
#	new file:   src/model/log.py
#	new file:   src/model/log_util.py
#	new file:   src/model/predict_utils.py
#	new file:   src/model/qa_predict.py
#	new file:   src/model/service_info.log
#	new file:   src/model/stat.log
#	new file:   src/model/tokenization.py
#	new file:   src/process_class.py
#	deleted:    src/recog_combine.py
#	modified:   src/recog_model.py
#	deleted:    src/recog_pattern.py
#	new file:   start_docker.sh
#
# Unmerged paths:
#   (use "git add/rm <file>..." as appropriate to mark resolution)
#
#	both modified:      docker/requirements.txt
#	both added:         log/access.log
#	both added:         log/dd.log
#	deleted by them:    start.sh
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	log/inside.log
#	log/sa_models.log
#	log/service.log
#	model/qalink.zip
#	service_info.log
#	stat.log
[atom_guoyanan@kdd7224 project_recognize]$ git add docker/requirements.txt
[atom_guoyanan@kdd7224 project_recognize]$ git add log/access.log
[atom_guoyanan@kdd7224 project_recognize]$ git add log/dd.log
[atom_guoyanan@kdd7224 project_recognize]$ git add start.sh
[atom_guoyanan@kdd7224 project_recognize]$ git commit -m "resolve conflict when develop merge to guoyanan"
[guoyanan 81c2e8d] resolve conflict when develop merge to guoyanan
[atom_guoyanan@kdd7224 project_recognize]$ git merge develop
Already up-to-date.

将之前提交过的文件取消追踪 git rm --cached 文件名

$ git rm --cached log/access.log
$ git commit -m "untrack log file"
$ git push
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值