簡體   English   中英

Git推送到本地倉庫說“一切都是最新的”,這不是

[英]Git push to local repo says “everything up to date”, it isn't

我有一個用於商家商店的主題。 我使用git來維護此主題的存儲庫(本地存儲庫1),將其克隆到dev文件夾(本地存儲庫2)中,然后在此工作,完成后,我想更新(推送?)到原始本地回購1.從那里我可以呈現zip文件或商人商店所需的任何東西。

所以我通過git init並添加文件並提交來制作repo1。 工作正常。 然后,將存儲庫克隆到我的dev文件夾中,並在那里設置我的Web服務。 很棒。 我編輯了主題並做出了適當的提交。 現在,我准備將這些更改放在實時服務器上,我想將其推送到應該是repo 1的源。但是,在進行提交后,當我嘗試通過repo2推送時

git checkout master

接着

git merge classes-migration

接着

git push

它說“一切都是最新的”,我嘗試過指定要推送的特定分支,說實話,我已經嘗試過各種方法來讀取此處的不同答案。


git branch [for repo1]

  classes-migration
  import-classes-migration
  initial-commit
* master

git status [for repo1]

On branch master
nothing to commit, working directory clean

git branch [for repo2]

  classes-migration
* master

git status [for repo2]

On branch master
Your branch is up-to-date with 'origin/master'.

nothing to commit, working directory clean

git remote show origin [for repo2]

* remote origin
  Fetch URL: /home/user/projects/merchant/repos/theme
  Push  URL: /home/user/projects/merchant/repos/theme
  HEAD branch: master
  Remote branches:
    classes-migration        tracked
    import-classes-migration new (next fetch will store in remotes/origin)
    initial-commit           tracked
    master                   tracked
  Local branches configured for 'git pull':
    classes-migration merges with remote classes-migration
    master            merges with remote master
  Local refs configured for 'git push':
    classes-migration pushes to classes-migration (up to date)
    master            pushes to master            (up to date)

是的。

push命令用於將您已經提交的內容放入服務器。 如果配置了git存儲庫,則將其克隆到開發機中,然后在此項目中工作。 之后,您需要提交更改。

更改后首先檢查狀態:

git status

如果收到此消息

Changes not staged for commit:

    (use "git add <file>..." to update what will be committed)
    (use "git checkout -- <file>..." to discard changes in working directory)

          modified:   filename.txt

no changes added to commit (use "git add" and/or "git commit -a")

這意味着您已經更改了文件filename.txt,如果更改了一個以上的文件,則每個文件都會在此處列出。 下一步是提交文件。

git commit filename.txt -m "commit comments"

之后,您推送到服務器:

git push

執行此命令后,當您克隆到另一台計算機或更新存儲庫時,用戶將看到修改。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM