почему git commit возвращает меня назад в ветку master? - PullRequest
0 голосов
/ 28 февраля 2019

У меня очень глупая ситуация, которая излишне усложнила мою настройку git.Я провел последние несколько дней, дергая себя за волосы, когда мои коммиты (много раз) забирают меня назад во времени.

Я хочу, чтобы кто-то проанализировал и предложил объяснение того, как это происходит, и только послеэто ясно, что мы хотим выйти из этого беспорядка.Это должно стать отличным примером для начинающих в git.

Итак, просто из-за недосмотра я инициализировал git-репо в ~/nlp и еще один git-репо в ~/nlp/annotate.Прежде чем я понял, что у меня есть два репозитория, я начал фиксировать и загружать в один и тот же пульт (размещенный на gitlab.com ).

Как будто этого было недостаточно, я также случайно определил один пульт как: [remote "nlp"], а другой как [remote "origin"].( возможно, возраст меня настигает ).

И, в довершение всего, у меня есть сервер (AWS Ubuntu машина, где я обычно git pull код, а иногда git pushот одного и того же репозитория gitlab.

Таким образом, в действительности у нас есть 3 локальных репо, толкающих на один и тот же пульт (с разными именами).

Чтобы усложнить ситуацию, существуют независимые .gitignore файлы на сервере и моей локальной машине с различными наборами файлов, настроенными внутри них.

Для диагностики я буду воспроизводить выходные данные git branch и git 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 server (local dir): ~/nlp (это основной dir на сервере)

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

git log localРодительский каталог iMac: ~/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'
| |/

git log локального подкаталога iMac ~/nlp/annotate

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.

git log локального каталога сервера Ubuntu ~/nlp:

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)

Задача состоит в том, чтобы выяснить, почему я получаю свои новые коммиты отмененными будущими коммитами.

Спасибо всем, кто примет вызов.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...