在我将要讲解的Git教程中,Git提交用于存储您所做的更改。
git push是用来做什么的?
在我将要讲解的Git教程中,Git提交用于存储您所做的更改。
git push是用来做什么的?
当前回答
提交更改时,将更改保存为本地存储库中的单个逻辑集。你可以多次这样做而不用推。在它们被推送之前,它们不会离开您的本地存储库,这意味着远程存储库还没有这些更改集,因此当其他人从远程存储库中进行拉取时,您的提交不会被拉取。
当您推送时,您在本地存储库中所做的所有提交将被传输到远程存储库,因此当共享此远程存储库的其他开发人员进行拉取时,他们将把您的更改传输到他们的本地存储库。 查看Git命令和备忘单。
其他回答
提交:向本地存储库添加更改
Push:将最后一次提交转移到远程服务器
基本上,Git commit会把你的更改放到本地存储库中,而Git push会把你的更改发送到远程位置。
有三件事需要注意:
Working directory — folder where our code files are present Local repository — This is inside our system. When we do the commit command the first time, then this local repository is created in the same place where our working directory is. Checkit (.git) file get created. After that whenever we do commit, this will store the changes we make in the file of the working directory to the local repository (.git). Remote repository — This is situated outside our system like on servers located any where in the world, like GitHub. When we make a push command then code from our local repository gets stored at this remote repository.
提交更改时,将更改保存为本地存储库中的单个逻辑集。你可以多次这样做而不用推。在它们被推送之前,它们不会离开您的本地存储库,这意味着远程存储库还没有这些更改集,因此当其他人从远程存储库中进行拉取时,您的提交不会被拉取。
当您推送时,您在本地存储库中所做的所有提交将被传输到远程存储库,因此当共享此远程存储库的其他开发人员进行拉取时,他们将把您的更改传输到他们的本地存储库。 查看Git命令和备忘单。
Git提交将您的更改记录到本地存储库。
Git用本地更改推送更新远程存储库。