Differences between revisions 1 and 2
Revision 1 as of 2019-07-23 08:35:46
Size: 596
Editor: NicoleThomas
Comment:
Revision 2 as of 2019-08-05 12:12:01
Size: 1530
Editor: NicoleThomas
Comment:
Deletions are marked like this. Additions are marked like this.
Line 31: Line 31:

=== Merging with local modification ===

 If you pull from the remote repository and there are local uncommitted modifications in files that have also been changed in the remote repository, you will fail and get a message like this: "Please, commit your changes or stash them before you can merge." <<BR>><<BR>>

 Then you have three options:<<BR>><<BR>>

  1. Commit changes
  {{{
git add ...
git commit ...
git pull
}}}

  2. Stash changes<<BR>><<BR>>

  Stashing acts as a stack, where you can push changes, and you pop them in reverse order.
  Stash, do the merge and then pull the stash:
  {{{
git stash
git pull
git stash pop
}}}

  3. Discard changes<<BR>><<BR>>

  Discard all local changes to all files and get current version from remote repository:
  {{{
git reset --hard origin/master
git pull
}}}
  Discard local changes for a specific file:
  {{{
git checkout -- filename
}}}
     

Update local CLaMS repository

Get changes from remote repository

  • Fetch and merge changes on the remote server to your working directory:
    git pull

See changes before pulling from remote git repository

  • Fetch changes from the remote repository:
    git fetch
    Show commit logs of changes / show diffs of changes:
    git log --name-status master..origin/master
    git diff --name-status master origin/master
    git diff master origin/master
    Apply the changes by merge or just pull the changes:
    git merge 
    or
    git pull

Merging with local modification

  • If you pull from the remote repository and there are local uncommitted modifications in files that have also been changed in the remote repository, you will fail and get a message like this: "Please, commit your changes or stash them before you can merge."

    Then you have three options:

    1. Commit changes
      git add ...
      git commit ...
      git pull
    2. Stash changes

      Stashing acts as a stack, where you can push changes, and you pop them in reverse order. Stash, do the merge and then pull the stash:

      git stash
      git pull
      git stash pop
    3. Discard changes

      Discard all local changes to all files and get current version from remote repository:

      git reset --hard origin/master
      git pull
      Discard local changes for a specific file:
      git checkout -- filename

GitLabUpdateClams (last edited 2024-02-15 08:58:51 by NicoleThomas)