gpt4 book ai didi

Instructions on git [closed](有关GIT的说明[已关闭])

转载 作者:bug小助手 更新时间:2023-10-28 09:56:20 25 4
gpt4 key购买 nike




I had a few questions while working with git

在使用Git时,我有几个问题



  1. How to always have the latest version of git repository

  2. What rules should be followed in order not to get conflicts with git push

  3. Do I need to do synchronization when I clone git repository. (HEAD -> main, origin/main) because it is not displayed this way during the clone, it is necessary to merge the branches.

  4. How to revert to a specific version on a remote server.

  5. I have not found a satisfactory answer to my questions on the Internet.


I made a git clone url -> coding -> git add . -> git commit -m "desc" -> git push. my friend too. But after several commits, a file conflict occurred. I solved the problem by merging the local branch with the remote repository. To avoid such problems, how to commit correctly?

我创建了一个git克隆url->coding->git add。->git Commit-m“desc”->git推送。我的朋友也是。但在多次提交后,发生了文件冲突。我通过合并本地分支和远程存储库解决了这个问题。要避免这样的问题,如何正确承诺?


更多回答
优秀答案推荐


  1. Try this when you want to synchronize


git fetch upstream ->
git checkout main->
git rebase upstream/main

Git上游取回->Git签出主目录->Git Rebase上游/主目录



These are great questions Dias,

这些都是很好的问题迪亚斯,



  1. always be sure to git pull prior to working in a repository, especially when working on a team. This will avoid conflicts and the need to merge.

  2. This goes in conjunction with your first question. If you pull before working on a repository, you will avoid most of the major conflicts.

  3. (please specify synchronization)

  4. Great Answer


Please let me know what else needs to be clarified. Thanks.

还有什么需要澄清的,请告诉我。谢谢。




To avoid such problems, how to commit correctly?



Commits have nothing to do with merge conflicts.

It's about changes in the same files your teammates and you contribute.

提交与合并冲突无关。它是关于你和你的队友贡献的相同文件的更改。


Sometimes you want to keep both changes in file, sometimes you want to leave only latest version, sometimes earlier.

This is about tracking of working lines within a project. Generally, you have to do it manually;

it is good advice to do git pull at the beginning of every working day though.

有时,您希望将这两个更改都保留在文件中,有时,您只希望保留最新版本,有时是更早版本。这是关于跟踪项目中的工作线。一般来说,你必须手动完成;不过,在每个工作日开始时做GIT Pull是个好建议。


更多回答

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com