git的庆典:如何检查是否有新的可提交 [英] git bash : how to check if there's a new commit available

查看:201
本文介绍了git的庆典:如何检查是否有新的可提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用git和我的朋友对一个项目进行合作。他创造了在github上回购包括我们每一个名字的文件夹,所以每次我更新的东西,我把它上传到这个文件夹,然后把它推到github上,也是如此,他。所以每次有一个新的承诺,我们必须从github上拉并复制编辑的文件粘贴到我们自己的本地主机(WAMP)。

所以我想问的:


  1. 我如何检查是否有从混帐bash的一个新的承诺,而检查GitHub上? Git的拉力将拉动最新版本我知道,但如果我只是想先检查?


  2. 我说的git文件夹位于D://混帐/ PROJECT_NAME。我可以将此文件夹复制到另一个位置(例如U盘),然后从这个USB做一个混帐拉?


  3. 如果我们的方法不见效,你对我们应该如何使用git任何建议?我们使用codeIgniter框架,所以起初我建议刚混帐推动整个codeIgniter文件夹,但我的朋友说,这是危险的(COS整体配置和数据库是存在的),没有必要(因为主系统文件夹将最有可能被改动)。因此,我们使用这种方法,电流(具有我们的名字两个文件夹和推拉每次有更新。



解决方案

在回答你的前两个问题依次是:


  1. 假设原产地表示的GitHub库在每种情况下,你应该只运行混帐获取原产地。那么远程跟踪分支产地/主将在主GitHub上的版本,你可以用你的主人比较一下 git的差异主产地/主来看看这两个版本之间的差异,或 git的日志主产地... /主来看看都有它独特的提交为产地/主

  2. 是的,你可以将存储库复制到U盘上,并从那里拉。但是,如果你想从USB密钥到另一台计算机上拉,你要建立一个指向USB密钥存储库的位置的遥控器。

至于是否有更好的方法做,你在做什么,我怕我不理解不够清楚自己在做或试图实现合理评论什么。然而,他们具有与(presumably)每个开发者的名字命名的存储库文件夹非常相似源$ C ​​$ C听起来有点可疑 - 你通常会使用树枝来处理同样的code的不同版本。

I use git with my friend to collaborate on a project. He created a repo in github consisting folders of each of our names, so everytime i update something, I upload it to this folder then push it to github, and so does he. So everytime there's a new commit, we have to pull from github and copy paste the edited files to our own localhost (wamp).

So what i want to ask :

  1. How do I check if there's a new commit from git bash without checking github? Git pull will pull the latest version i know, but what if i just want to check first?

  2. Say my git folder is located in D://git/project_name. Can I copy this folder to another location (for example USB Flash Disk) then do a git pull from this USB?

  3. If our method isn't effective, do you have any proposal on how we should use git? We're using CodeIgniter framework, so at first I proposed to just git push the whole CodeIgniter folders, but my friend said it's dangerous (cos the whole config and database is there) and unnecessary (since the main system folder will most likely be untouched). So we're using this current method (having two folders with our names and pushing and pulling everytime there's an update.

解决方案

Answering your first two questions in turn:

  1. Assuming that origin refers to the GitHub repository in each case, you should just run git fetch origin. Then the "remote-tracking branch" origin/master will be at the version of master on GitHub and you can compare it with your master with git diff master origin/master to see the difference between those two versions, or git log master...origin/master to see the commits which are unique to either master or origin/master.
  2. Yes, you can copy the repository to a USB stick and pull from there. However, if you want to pull from the USB key onto another computer, you'll want to set up a remote that refers to the location of the repository on the USB key.

With regard to whether there is a better way to do what you're doing, I'm afraid I don't understand clearly enough what you're doing or trying to achieve to comment sensibly. However, having folders in the repository named after each developer with (presumably) very similar source code in them sounds a little suspect - you would typically use branches to deal with divergent versions of the same code.

这篇关于git的庆典:如何检查是否有新的可提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆