为什么git commit带我回到master分支上?

时间:2019-02-28 10:49:23

标签: git

我的情况非常愚蠢,使git设置不必要地复杂。当我的承诺(很多次)使我回到过去时,我花了几天的时间梳理头发。

我希望有人进行分析,并就其如何发生做出解释,只有在明确这一点之后,我们才想摆脱这种混乱。对于git入门者来说,这也是一个很好的案例研究。

因此,纯粹出于疏忽,我在~/nlp中初始化了一个git repo,在~/nlp/annotate中初始化了另一个git repo。在意识到有两个存储库之前,我开始提交并推送到同一远程服务器(托管在gitlab.com上)。

似乎这还不够,我也意外地将一个远程定义为[remote "nlp"],将另一个远程定义为[remote "origin"]。 (也许年龄正在赶上我)。

然后最重要的是,我有一台服务器(AWS ubuntu机器,通常在其中我git pull编写代码,有时git push到同一gitlab存储库。

因此,实际上,我们有3个本地存储库推送到同一远程主机(具有不同的名称)。

令事情复杂化的是,服务器和我的本地计算机上有独立的.gitignore文件,其中设置了不同组文件。

为进行诊断,我将从三个本地存储库的每一个中复制git branchgit log的输出。

  

本地mac:~/nlp


Main-iMac:nlp sm$ git branch -vv
      checkout    2647194 now added studqa3.csv - was missed earlier
      main        d628391 speeded up tokenisation.
    * master      301e7f6 [origin/master: ahead 1] the code worked on shinyapps.io
      rdrop       d628391 [rdrop/rdrop] speeded up tokenisation.
      shinyServer 0a35421 [origin/shinyServer] adding 3 new files in annotate
      shiny_sm    ff32074 [origin/shiny_sm] changes in q & a (editing pre existing q&a) shiny app working prototype

  

本地mac:~/nlp/annotate :(这是子目录)

Main-iMac:annotate sm$ git branch -vv
* master d90c690 Checking a repeat commit from subdirectory

  

aws ubuntu服务器(本地目录):~/nlp(这是服务器上的主目录)

studio@ip-172-31-30-19:~/nlp$ git branch --v
* master    e652dc9 added back mandira new
  rdrop_aws 6be4e81 approvals
  

本地iMac父目录的{git日志:~/nlp

Main-iMac:nlp sm$ git log --source --decorate --oneline --all --graph
* 301e7f6       refs/heads/master (HEAD -> master) the code worked on shinyapps.io
* c8b7235       refs/remotes/origin/master (origin/master) new app for rdrop testing
* c9df566       refs/remotes/origin/master new & simpler validate function for studqa positions only
* e652dc9       refs/remotes/origin/master added back mandira new
* daa9d78       refs/remotes/origin/master committing after the merged users.csv
* 57ecbb7       refs/remotes/origin/master merge users.csv
* 950c30b       refs/remotes/origin/master checking out one file delete on AWS server, to see if it syncs back to local
* 76e0580       refs/remotes/origin/master added 2 more students (old names)
* 430c7fa       refs/remotes/origin/master added a few more columns in student results function
* c716532       refs/remotes/origin/master dupques updated
* 2dcfc1c       refs/remotes/origin/master latest approvals added
* 34a1dd7       refs/remotes/origin/master first commit of servfunc.R - not needed in local machine.
* 06d8304       refs/remotes/origin/master approvals
* 8c801ea       refs/remotes/origin/master Removed the regex bug
*   16c7e54     refs/remotes/origin/master Merge branch 'master' of https://gitlab.com/sanjmeh/nlp
|\
| * 7e925c8     refs/remotes/origin/master improved the table filter of DT for admim
| *   1054bb7   refs/remotes/origin/master I feel this was a dangerous merge. Merge branch 'master' of https://gitlab.com/sanjmeh/nlp
| |\
| | *   a9d5d85 refs/remotes/origin/master Merge branch 'rdrop' into 'master'
| | |\
| | | * d628391 refs/heads/main (rdrop/rdrop, origin/rdrop, rdrop, main) speeded up tokenisation.
| | | * fbf093d refs/heads/main first commit on rdrop. Small css change to test.
| * | | 192a02f refs/remotes/origin/master Adding outside.R - and using nlp parent git
| | |/
| |/|
* | | 6be4e81   refs/remotes/origin/master approvals
|/ /
| | *   6b26385 refs/stash (refs/stash) WIP on (no branch): 876bac8 Merge branch 'rdrop' into 'master'
| | |\
| |/ /
| | * b094d2f   refs/stash index on (no branch): 876bac8 Merge branch 'rdrop' into 'master'
| |/
  

本地iMac子目录~/nlp/annotate的git日志

Main-iMac:annotate sm$ git log --source --decorate --oneline --all --graph
* d90c690       refs/heads/master (HEAD -> master) Checking a repeat commit from subdirectory
* 9f454d1       refs/heads/master remove staging for deleted file
* 28f9fcd       refs/heads/master cat changed to message
* 6a2d89c       refs/heads/master all data files
* 45f000a       refs/remotes/nlp/master (nlp/master) updated pull_all_studqa()
* 39cdd99       refs/remotes/nlp/master LUCI title changed
* d6cfc2c       refs/remotes/nlp/master Removed transfer of property keywords
* b21668b       refs/remotes/nlp/master Just a few cosmetic changes
* cdd1d02       refs/remotes/nlp/master as_tibble removed
* bebfb4f       refs/remotes/nlp/master new functions: smoothen, remdir, remove_old_dir, fixed content_len bug
* 3d88ec3       refs/remotes/nlp/master All data files..
* e21f377       refs/remotes/nlp/master synching new 44 student creds and initial data files in all 44 directories. If any dir missed will do another commit.
* 8ea59e4       refs/remotes/nlp/master deleted a RDS file
* af7aaa0       refs/remotes/nlp/master ONLY ADMIN PANEL changes. - added new css tags - changes in search strings / admin panel - new paradty pdty4.rds hardcoded.* 18c640d       refs/remotes/nlp/master New functions added with css changes. Bug in remove_hyphen removed. Completely overhauled val_studqa()
* 82b1f4a       refs/remotes/nlp/master lots of changes not committed earlier
* df16b92       refs/remotes/nlp/master fill=T added
* 037d0bb       refs/remotes/nlp/master changed the highlighted text to red font and increased font size and line space for paragraphs.
* 30acdb2       refs/remotes/nlp/master changed datetime to as.character in tail table - also changed from DT to normal tableOutput
* 5f678a3       refs/remotes/nlp/master changed to users.csv
* 6e6cd54       refs/remotes/nlp/master dhruv directory
* 7ed1fd2       refs/remotes/nlp/master abhiroop, aditya, apurva uploaded
* 942f363       refs/remotes/nlp/master Data files being uploaded needed for launch.
* 5dcfe1a       refs/remotes/nlp/master simple comment changes.
* 9c358ff       refs/remotes/nlp/master with changes that were done long ago.
* 0f8ff9d       refs/remotes/nlp/master all deleted files synced.
* 4f90df2       refs/remotes/nlp/master deleted unused user directories
* ba6a339       refs/remotes/nlp/master new files added for initializing missing data tables for new students.
* 2a59217       refs/remotes/nlp/master new users loaded for JAN launch.
* a4cf17f       refs/remotes/nlp/master Host of fucntions used for splitting and reassigning data for students changed.  - add_acts is overhauled on para level split.  - Case splitt
ing logic overhauled.  - User directory logic improved.* 28902e3       refs/remotes/nlp/master While admin module has many changes this version is ready for annotations for students. Not yet ready for admin.
* df4d0c6       refs/remotes/nlp/master Started to add FILTER tab with data mgmt.. WIP. WOrks to display all cases.
  

ubuntu服务器本地目录~/nlp的git日志:

rstudio@ip-172-31-30-19:~/nlp$  git log --source --decorate --oneline --all --graph
* e652dc9       refs/heads/master (HEAD -> master) added back mandira new
* daa9d78       refs/heads/master committing after the merged users.csv
* 57ecbb7       refs/heads/master merge users.csv
* 950c30b       refs/heads/master checking out one file delete on AWS server, to see if it syncs back to local
* 76e0580       refs/heads/master added 2 more students (old names)
* 430c7fa       refs/heads/master added a few more columns in student results function
* c716532       refs/heads/master dupques updated
* 2dcfc1c       refs/heads/master latest approvals added
* 34a1dd7       refs/heads/master first commit of servfunc.R - not needed in local machine.
* 06d8304       refs/heads/master approvals
* 8c801ea       refs/heads/master Removed the regex bug
*   16c7e54     refs/heads/master Merge branch 'master' of https://gitlab.com/sanjmeh/nlp
|\
| * 7e925c8     refs/heads/master improved the table filter of DT for admim
| *   1054bb7   refs/heads/master I feel this was a dangerous merge. Merge branch 'master' of https://gitlab.com/sanjmeh/nlp
| |\
| | *   a9d5d85 refs/heads/master Merge branch 'rdrop' into 'master'
| | |\
| | | * d628391 refs/heads/master speeded up tokenisation.
| | | * fbf093d refs/heads/master first commit on rdrop. Small css change to test.
| | * |   876bac8       refs/heads/master Merge branch 'rdrop' into 'master'
| | |\ \
| | | |/
| | |/|
| | | * 79e469f refs/heads/master Sample merge: deleted extra RDS files and one small CSS change
| | |/
| * | 192a02f   refs/heads/master Adding outside.R - and using nlp parent git
| |/
* | 6be4e81     refs/heads/rdrop_aws (rdrop_aws) approvals
|/
* d10a58a       refs/heads/master app reverted from test mode title & color to normal title and color
* 1b7f430       refs/heads/master removed stop button
*   5b54770     refs/heads/master Merge branch 'master' of https://gitlab.com/sanjmeh/nlp
|\
| * 64feca3     refs/heads/master Added message() in a function
| * f3040eb     refs/heads/master commit from aws server:  - still multi user clash occuring but now the frequent disconnection is gone.  - the replaceData(proxytable..) is replacing the DT of anotheruser. - WIP

更新 远程跟踪信息也可能有用。

Main-iMac:annotate sm$ git remote -v
nlp     https://gitlab.com/sanjmeh/nlp (fetch)
nlp     https://gitlab.com/sanjmeh/nlp (push)

Main-iMac:annotate sm$ cd ..
Main-iMac:nlp sm$ git remote -v
origin  https://gitlab.com/sanjmeh/nlp.git (fetch)
origin  https://gitlab.com/sanjmeh/nlp.git (push)
rdrop   https://gitlab.com/sanjmeh/nlp.git (fetch)
rdrop   https://gitlab.com/sanjmeh/nlp.git (push)

面临的挑战是弄清楚为什么我的新提交被以后的提交所推翻。

感谢任何接受挑战的人。

0 个答案:

没有答案