我在服务器中有一个git存储库,我必须将数据推入并拉入其中。当我试图拉一个实例时,我的很多文件都被删除了,即使它存在于存储库中。我使用的命令如下所示
git add .
git add -u
git commit -m 'comments'
git pull origin master
这是终端在运行这些命令时发生的事情
manesh@sysadmin-PC:/var/www/MobpazAdmin$ git add .
manesh@sysadmin-PC:/var/www/MobpazAdmin$ git add -u
manesh@sysadmin-PC:/var/www/MobpazAdmin$ git commit -m 'with add ads'
[master 5706969] with add ads
Committer: Manesh <manesh@sysadmin-PC.(none)>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email you@example.com
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
10 files changed, 523 insertions(+), 5 deletions(-)
create mode 100755 src/Mobpaz/AdminBundle/Controller/AdsController.php
create mode 100644 src/Mobpaz/AdminBundle/Entity/Ads.php
create mode 100644 src/Mobpaz/AdminBundle/Entity/AdsRepository.php
create mode 100644 src/Mobpaz/AdminBundle/Resources/config/doctrine/metadata/orm/Ads.orm.xml
create mode 100755 src/Mobpaz/AdminBundle/Resources/views/Ads/addads.html.twig
create mode 100755 src/Mobpaz/AdminBundle/Resources/views/Ads/index.html.twig
mode change 100644 => 100755 src/Mobpaz/AdminBundle/Resources/views/Logs/index.html.twig
manesh@sysadmin-PC:/var/www/MobpazAdmin$ git pull origin master
git@192.168.10.241's password:
remote: Counting objects: 50, done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 28 (delta 14), reused 0 (delta 0)
Unpacking objects: 100% (28/28), done.
From 192.168.10.241:/var/www/repositories/Mobpaz/MobpazAdmin
* branch master -> FETCH_HEAD
Auto-merging src/Mobpaz/AdminBundle/Resources/views/base.html.twig
Auto-merging src/Mobpaz/AdminBundle/Resources/views/Logs/index.html.twig
Auto-merging src/Mobpaz/AdminBundle/Resources/config/routing.yml
CONFLICT (content): Merge conflict in src/Mobpaz/AdminBundle/Resources/config/routing.yml
Automatic merge failed; fix conflicts and then commit the result.
manesh@sysadmin-PC:/var/www/MobpazAdmin$ git add .
manesh@sysadmin-PC:/var/www/MobpazAdmin$ git add -u
manesh@sysadmin-PC:/var/www/MobpazAdmin$ git commit -m 'with add ads'
[master 0c0e548] with add ads
Committer: Manesh <manesh@sysadmin-PC.(none)>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email you@example.com
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
manesh@sysadmin-PC:/var/www/MobpazAdmin$ git commit -m 'with add ads'
# On branch master
nothing to commit (working directory clean)
manesh@sysadmin-PC:/var/www/MobpazAdmin$ git pull origin master
git@192.168.10.241's password:
From 192.168.10.241:/var/www/repositories/Mobpaz/MobpazAdmin
* branch master -> FETCH_HEAD
Already up-to-date.
我解决了在第二次拉动之前发生的冲突。 请告诉我,我做错了这种情况经常发生,因此我的工作在每次推拉后都会中断。
我的问题是,即使存储库中的文件也会从我的本地副本中删除。
答案 0 :(得分:2)
我认为你错误地认为commit
与push
的比较。
commit
创建一个本地临时区域供您使用。这是完全本地的,您的git服务器没有这些更改的概念。
当您push
进行更改时(commit
之后),您的服务器将保留您的更改。
很抱歉,如果我在这里不正确,您的日志就没有push
次来电。