Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- Developer John committed some changes
- After John pushed changes to central server, developer Roger did the following:
- roger@work ~some_repo (some_branch)
- $ git pull origin <some_branch>
- From ssh://git.server:2400/some_repo
- * branch some_branch -> FETCH_HEAD
- Auto-merging sample.sh
- CONFLICT (content): Merge conflict in sample.sh
- Automatic merge failed; fix conflicts and then commit the result.
- roger@work ~some_repo (some_branch|MERGING)
- $ git status
- # On branch some_branch
- # Your branch is ahead of 'origin/some_branch' by 2 commit.
- # (use "git push" to publish your local commits)
- #
- # You have unmerged paths.
- # (fix conflicts and run "git commit")
- #
- # Unmerged paths:
- # (use "git add <file>..." to mark resolution)
- #
- # both modified: sample.sh
- ...
- ...
- ...
- roger@work ~some_repo (some_branch|MERGING)
- $ git reset .
- Unstaged changes after reset
- M sample.sh
- roger@work ~some_repo (some_branch|MERGING)
- $ git checkout .
- roger@work ~some_repo (some_branch|MERGING)
- $ git status
- # On branch some_branch
- # Your branch is ahead of 'origin/some_branch' by 2 commit.
- # (use "git push" to publish your local commits)
- #
- # All conflicts fixed but you are still merging.
- # (use "git commit" to conclude merge)
- # 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: sample.sh
- #
- # no changes added to commit (use "git add" and/or "git commit -a")
- roger@work ~some_repo (some_branch|MERGING)
- $ git add sample.sh
- roger@work ~some_repo (some_branch|MERGING)
- $ git commit -m "JIRA_ID-33065"
- roger@work ~some_repo (some_branch|MERGING)
- $ git push origin some_branch
- Counting objects: 59, done.
- Delta compression using...
- ...
- ...
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- Now i tried simulating the above scenario by creating two users (tom and harry) in Gitolite but could not succeed.
- 1. User A modified, committed and pushed changes in a file (startServer.sh).
- tom@lappyA /d/git/some_branch (some_branch)
- $ vim startServer.sh
- tom@lappyA /d/git/some_branch (some_branch)
- $ git add startServer.sh
- tom@lappyA /d/git/some_branch (some_branch)
- $ git commit -m "JIRA_ID-33065: Added dot to startServer.sh script"
- tom@lappyA /d/git/some_branch (some_branch)
- $ git push origin some_branch
- 2. After Tom pushed the above changes, Harry did not perform any pull on his machine. He instead modified the same file and the same line which Tom did. Harry then committed the changes. Harry, when tried pushing his changes, got some different message than the one which the original developer (in this case, Roger) got. Besides working on a common file (startServer.sh), Harry also wanted to check-in another file (stopServer.sh) which Tom did not change.
- [harry@master some_branch]$ vim startServer.sh
- [harry@master some_branch]$ git add startServer.sh
- [harry@master some_branch]$ git commit -m "JIRA_ID-1234: Added 5 dots in startServer"
- [some_branch d97664e] JIRA_ID-1234: Added 5 dots in startServer
- 1 file changed, 1 insertion(+), 1 deletion(-)
- [harry@master some_branch]$ git pull origin some_branch
- From ssh://git.server:2400/some_branch
- * branch some_branch -> FETCH_HEAD
- Auto-merging startServer.sh
- CONFLICT (content): Merge conflict in startServer.sh
- Automatic merge failed; fix conflicts and then commit the result.
- [harry@master some_branch]$ git status
- On branch some_branch
- Your branch and 'origin/some_branch' have diverged,
- and have 1 and 1 different commit each, respectively.
- (use "git pull" to merge the remote branch into yours)
- You have unmerged paths.
- (fix conflicts and run "git commit")
- Unmerged paths:
- (use "git add <file>..." to mark resolution)
- both modified: startServer.sh
- no changes added to commit (use "git add" and/or "git commit -a")
- [harry@master some_branch]$ git reset .
- Unstaged changes after reset:
- M startServer.sh
- [harry@master some_branch]$ git status
- On branch some_branch
- Your branch and 'origin/some_branch' have diverged,
- and have 1 and 1 different commit each, respectively.
- (use "git pull" to merge the remote branch into yours)
- All conflicts fixed but you are still merging.
- (use "git commit" to conclude merge)
- 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: startServer.sh
- no changes added to commit (use "git add" and/or "git commit -a")
- [harry@master some_branch]$ git checkout .
- [harry@master some_branch]$ git status
- On branch some_branch
- Your branch and 'origin/some_branch' have diverged,
- and have 1 and 1 different commit each, respectively.
- (use "git pull" to merge the remote branch into yours)
- All conflicts fixed but you are still merging.
- (use "git commit" to conclude merge)
- nothing to commit, working directory clean
- [harry@master some_branch]$ vim stopServer.sh
- [harry@master some_branch]$ git status
- On branch some_branch
- Your branch and 'origin/some_branch' have diverged,
- and have 1 and 1 different commit each, respectively.
- (use "git pull" to merge the remote branch into yours)
- All conflicts fixed but you are still merging.
- (use "git commit" to conclude merge)
- 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: stopServer.sh
- no changes added to commit (use "git add" and/or "git commit -a")
- [harry@master some_branch]$ git add stopServer.sh
- [harry@master some_branch]$ git commit -m "JIRA_ID-1234: Removed dots from script"
- [some_branch a13330a] JIRA_ID-1234: Removed dots from script
- [harry@master some_branch]$ git push origin some_branch
- Counting objects: 5, done.
- Delta compression using up to 2 threads.
- Compressing objects: 100% (5/5), done.
- Writing objects: 100% (5/5), 627 bytes | 0 bytes/s, done.
- Total 5 (delta 3), reused 0 (delta 0)
- remote: As it is a merge no need to do any validation
- remote: To gitolite@release_team_essentials:some_branch.git
- remote: b44fd4e..a13330a some_branch -> some_branch
- To ssh://gitolite@git.server:2400/some_branch
- b44fd4e..a13330a some_branch -> some_branch
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement