Some minor problems or information required while using git

  1. Sometimes when I try to clone the repo it shows me this error:

    Cloning into 'openmrs-core'...

    error: RPC failed; result=22, HTTP code = 502

    fatal: The remote end hung up unexpectedly
    Solution:

    1. Run this: git config --global http.postBuffer 524288000 //to increase the buffer size.
    2. Then clone again.
  2. You clone your repository. Howerver there are commits in the main repo which you don't want to miss out while cloning. You cannot delete your repository and fork again because you have made many branches hence you don't want to delete them.
    Type these commands: source (https://help.github.com/articles/syncing-a-fork)
    1. git remote -v
      1. # List the current remotes
        # origin https://github.com/user/repo.git (fetch)
        # origin https://github.com/user/repo.git (push)
         
    2. git remote add upstream https://github.com/openmrs/openmrs-core.git
      # Set a new remote
    3. git remote -v
      # Verify new remote
      # origin https://github.com/user/repo.git (fetch)
      # origin https://github.com/user/repo.git (push)
      # upstream https://github.com/octocat/repo.git (fetch)
      # upstream https://github.com/octocat/repo.git (push)
      Syncing:
      Fetching:
    4. git fetch upstream
      # Grab the upstream remote's branches
      # remote: Counting objects: 75, done.
      # remote: Compressing objects: 100% (53/53), done.
      # remote: Total 62 (delta 27), reused 44 (delta 9)
      # Unpacking objects: 100% (62/62), done.
      # From https://github.com/octocat/repo
      #  * [new branch] master -> upstream/master
    5. git branch -va  
      # List all local and remote-tracking branches
      # * master a422352 My local commit
      # remotes/origin/HEAD -> origin/master  
      # remotes/origin/master a422352 My local commit
      # remotes/upstream/master 5fdff0f Some upstream commit
      Merging
    6. git checkout master
      # Check out our local master branch
      # Switched to branch 'master'
    7. git merge upstream/master
      # Merge upstream's master into our own
      # Updating a422352..5fdff0f
      # Fast-forward
      #  README | 9 -------
      #  README.md | 7 ++++++
      #  2 files changed, 7 insertions(+), 9 deletions(-)
      #  delete mode 100644 README
      #  create mode 100644 README.md