国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網管 > 服務器 > 正文

git命令添加 修改 刪除 沖突解決辦法

2020-05-27 13:03:47
字體:
來源:轉載
供稿:網友

   如果對git命令行不熟悉的話,用git圖形界面工具,就比較合適了。建議使用tortoisegit這樣的工具,命令行從學習到靈活掌握的時間成本比較高的。

  1,添加

  # git clone git@192.168.10.202:develop/test.git

  # cd test

  # touch test.txt //測試文件

  # git add test.txt //git添加文件

  # git commit -m test //添加到本地版本庫

  # git push //push到遠程

  如果push報錯,Perhaps you should specify a branch such as master

  解決辦法:

  # git push origin master //只要這樣操作一次,以后就可以用git push

  添加文件和添加目錄,操作是一樣的。

  2,修改文件

  方法一

  # echo "11111111111" > test.txt

  # git add test.txt && git commit -m test2

  # git push

  方法二

  # echo "abc" > test.txt

  # git commit -am "test3" //所有修改都會提交

  # git push

  如果有多個文件,只想提交其中的一個或者多個,怎么辦呢

  # git commit -a //該命令出現以下內容

  # Please enter the commit message for your changes. Lines starting

  # with # will be ignored, and an emptyempty message aborts the commit.

  # On branch master

  # Changes to be committed:

  # (use "git reset HEAD ..." to unstage)

  #

  # modified: ab

  # modified: test.txt //如果只想提交test.txt,只要把該行前的#去掉,保存退出就行了

  # git push //退出后,在執行push

  3,刪除

  # git rm ab //如果刪除目錄的話,加上-r

  # git commit -am "del"

  # git push

  4,解決沖突

  # git push //push不上去

  Address 192.168.10.202 maps to unassigned.psychz.net, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!

  To git@192.168.10.202:develop/test.git

  ! [rejected] master -> master (non-fast-forward)

  error: failed to push some refs to 192.168.10.202:develop/test.git

  To prevent you from losing history, non-fast-forward updates were rejected

  Merge the remote changes before pushing again. See the Note about

  fast-forwards section of git push --help for details.

  # git pull //更新代碼,提示沖突

  Address 192.168.10.202 maps to unassigned.psychz.net, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!

  remote: Counting objects: 5, done.

  remote: Compressing objects: 100% (2/2), done.

  remote: Total 3 (delta 0), reused 0 (delta 0)

  Unpacking objects: 100% (3/3), done.

  From 192.168.10.202:develop/test

  367dad3..5e5640b master -> origin/master

  Auto-merging test.txt

  CONFLICT (content): Merge conflict in test.txt

  Automatic merge failed; fix conflicts and then commit the result.

  # vim test.txt //修改沖突文件,并保存

  # git commit -am "remove conflict" //重新提交到本地版本庫

  # git push //同步到遠程

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 滕州市| 谷城县| 广宁县| 剑河县| 登封市| 城口县| 宁阳县| 曲沃县| 横山县| 渑池县| 沁水县| 宁陕县| 乌拉特中旗| 临潭县| 资源县| 若羌县| 台北县| 锡林浩特市| 溆浦县| 彩票| 宜兰县| 浏阳市| 饶平县| 水城县| 凤山县| 庆安县| 如皋市| 海南省| 江口县| 长汀县| 和林格尔县| 肇东市| 福贡县| 阜南县| 杭州市| 平和县| 苗栗市| 堆龙德庆县| 七台河市| 合水县| 盐源县|