📁
til
  • Today I Learned
  • Bookmarks
    • Bookmarks
  • Centos
    • How to limit bandwidth on CentOS
  • CI/CD
    • Add a mac as a GitLab runner
    • Setup CI pipeline for iOS projects on gitlab.com
  • cocoapods
    • private-spec-repo
    • CocoaPods save project.pbxproj file in XML plist format on Xcode 7.3.1
  • git
    • Git keeps asking password after El Capitan Upgrade
    • change-case-sensitivity-of-filename
    • interactive-rebase
    • Fork a repo
  • hacking
    • Decompile Android apk
  • homebrew
    • Bash Completion
  • ios
    • ats
    • Failed to open Xcode (LSOpenURLsWithRole() failed with error -10699)
    • Redirect to Settings Page
    • Retrieve expiry date of Provisioning Profile Certificate from .ipa
    • WKWebView set custom HTTP headers
    • IAP applicationUsername is nil
  • Jenkins
    • Create stage dynamically in declarative pipeline
  • mac
    • Catalina failed to sync iPhone with Finder
  • networking
    • shadowsocks vs. VPN
  • Objective-C
    • Keep subview in Scroll View always on screen
    • Custom View using xib
    • Scroll up TextField when keyboard shows
    • autolayout-hugging-vs-resistance
  • Regex
    • regex-chinese-char
  • SQL
    • update-json-value-in-postgresql
    • select-random-row-in-sql
  • SSH
    • verify-ssh-passphrase
  • SVN
    • Svn Checkout Directories only
  • swift
    • equatable
  • unix
    • Create and Grant Sudo Privileges to user
    • Create and Change Current Directory
    • Show ASCII Text welcome message when login with SSH
  • vim
    • Vim with Multiple Files
Powered by GitBook
On this page
  • Steps
  • 1. Create our fork repo (on our git server)
  • 2. Clone our fork repo (on local machine)
  • 3. Add upstream repo as a remote
  • 4. Pull from upstream and push to our fork repo

Was this helpful?

  1. git

Fork a repo

In GitHub, when we want to make changes on someone else's project, we would fork(copy) the repo to our own account, so we can make changes to the project, without affecting the original project.

If we are not using GitHub, we can add a upstream remote to do the same thing.

We have 3 different repos:

  • Upstream repo (3rd party repo)

  • Our fork repo (a copy of upstream repo, and we have full control)

  • Our local repo (a clone of our fork repo, our working copy in local machine)

Steps

  1. Create our fork repo

  2. Clone our fork repo on local machine

  3. Add upstream repo as a remote

  4. Pull from upstream and push to our fork repo

1. Create our fork repo (on our git server)

$ git init --bare {path_to_repo}/our-fork.git

2. Clone our fork repo (on local machine)

$ mkdir -p {path_to_our_working_copy} && cd $_ 
$ git clone {our_fork_url}

3. Add upstream repo as a remote

list all remotes:

$ git remote -v

origin {our_fork_url} (fetch)
origin {our_fork_url} (push)

Add upstream repo

$ git remote add upstream {upstream_repo_url}

# list all remotes again
$ git remote -v

origin {our_fork_url} (fetch)
origin {our_fork_url} (push)
upstream {upstream_repo_url} (fetch)
upstream {upstream_repo_url} (push)

4. Pull from upstream and push to our fork repo

Previousinteractive-rebaseNextDecompile Android apk

Last updated 5 years ago

Was this helpful?