git 推送前多次提交
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5143984/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Multiple commits before pushing
提问by bjork24
I'm completely new to GIT, so excuse the naivety. If I'm working on a project offline, and I do multiple commits then push the changes once I'm back online, will all the commits show up in my repository, or just the last one I did before going back online?
我对 GIT 完全陌生,所以请原谅我的幼稚。如果我正在离线处理一个项目,并且我做了多次提交,然后在我重新上线后推送更改,所有提交都会显示在我的存储库中,还是只是我在重新上线之前所做的最后一个?
采纳答案by Cascabel
Git is a distributed version control system. Your repository is entirelyyour own, and it contains absolutely everything you need. Committing takes place only within your repository; it has nothing to do with whether or not you're online.
Git 是一个分布式版本控制系统。您的存储库完全是您自己的,它绝对包含您需要的一切。提交仅在您的存储库中进行;这与您是否在线无关。
The things that you need to be online for are pushing (publishing your commits to another repository) and pulling (fetching and merging commits from another repository). When you push, it will push exactly what you told it to - all of the commits on that branch. It doesn't matter when you made them or if your network cable was plugged in at the time.
您需要在线的事情是推送(将您的提交发布到另一个存储库)和拉取(从另一个存储库获取和合并提交)。当您推送时,它会完全推送您告诉它的内容 - 该分支上的所有提交。制作它们的时间或当时是否已插入网线都无关紧要。
回答by krtek
All your commits will be pushed.
您的所有提交都将被推送。
回答by anthonysomerset
all commits will get pushed and everyone that also uses your repo will also see all the individual commits that you pushed and work with them as they would normally
所有提交都将被推送,并且每个也使用您的存储库的人也将看到您推送的所有个人提交并像往常一样使用它们
回答by Kishor
Gitis a distributed version control system, meaning your local copy of the code is a complete version control repository. These fully-functional local repositories make it is easy to work offline or remotely. You commit your work locally, and then sync your copy of the repository with the copy on the server.
Git是一个分布式版本控制系统,这意味着您的本地代码副本是一个完整的版本控制存储库。这些功能齐全的本地存储库使离线或远程工作变得容易。您在本地提交您的工作,然后将您的存储库副本与服务器上的副本同步。
When you commit offline it will store that info in the local directory and when you connect to the internet and push your local repo, all your commits will sync to online GitHub directory.
当您离线提交时,它将将该信息存储在本地目录中,当您连接到互联网并推送您的本地存储库时,您的所有提交都将同步到在线 GitHub 目录。
The good thing about this is that your commit will be shown on Contribution activity graph with same time and date when you committed them offline.
这样做的好处是,当您离线提交时,您的提交将显示在贡献活动图表上,时间和日期相同。