Here I have forked from "https://github.com/MaxKHK/Udacity_DeepLearningAssignments" in my and created in my Git a forked branch.
Forked branch is: https://github.com/zytham/Udacity_DeepLearningAssignments.git
1. Setup origin : Initialise a directory with git features (git init)
➜ devinline-git-recap git init Initialized empty Git repository in /Users/n0r0082/devinline-git-recap/.git/ ➜ devinline-git-recap git:(master) git remote add origin https://github.com/zytham/Udacity_DeepLearningAssignments.git
Note: Alternatively we could have directly cloned the forked repo using command :
git clone <https://github.com/zytham/Udacity_DeepLearningAssignments.git>
2. List the configured remote repository for fork :
➜ devinline-git-recap git:(master) git remote -v origin https://github.com/zytham/Udacity_DeepLearningAssignments.git (fetch) origin https://github.com/zytham/Udacity_DeepLearningAssignments.git (push)
3. Setup upstream and Verify the new upstream repository : Remote upstream repository that will be synced with the fork.
➜ devinline-git-recap git:(master) git remote add upstream https://github.com/MaxKHK/Udacity_DeepLearningAssignments.git ➜ devinline-git-recap git:(master) git remote -v origin https://github.com/zytham/Udacity_DeepLearningAssignments.git (fetch) origin https://github.com/zytham/Udacity_DeepLearningAssignments.git (push) upstream https://github.com/MaxKHK/Udacity_DeepLearningAssignments.git (fetch) upstream https://github.com/MaxKHK/Udacity_DeepLearningAssignments.git (push)
Note: Instead of remote name as origin and upstream we can use any name, but by convention if using just two remote repository we use origin and upstream.
origin — that is the default name Git gives to the server you cloned from.
Renaming and Removing Remote
git remote rename <OLD_NAME> <NEW_NAME>git remote remove <REMOTE_NAME>
Rename remote
➜ devinline-git-recap git:(master) ✗ git remote -v origin https://github.com/zytham/Udacity_DeepLearningAssignments.git (fetch) origin https://github.com/zytham/Udacity_DeepLearningAssignments.git (push) upstream https://github.com/MaxKHK/Udacity_DeepLearningAssignments.git (fetch) upstream https://github.com/MaxKHK/Udacity_DeepLearningAssignments.git (push) ➜ devinline-git-recap git:(master) ✗ git remote rename upstream upstr ➜ devinline-git-recap git:(master) ✗ git remote -v origin https://github.com/zytham/Udacity_DeepLearningAssignments.git (fetch) origin https://github.com/zytham/Udacity_DeepLearningAssignments.git (push) upstr https://github.com/MaxKHK/Udacity_DeepLearningAssignments.git (fetch) upstr https://github.com/MaxKHK/Udacity_DeepLearningAssignments.git (push)
➜ devinline-git-recap git:(master) ✗ git remote -v origin https://github.com/zytham/Udacity_DeepLearningAssignments.git (fetch) origin https://github.com/zytham/Udacity_DeepLearningAssignments.git (push) upstream https://github.com/MaxKHK/Udacity_DeepLearningAssignments.git (fetch) upstream https://github.com/MaxKHK/Udacity_DeepLearningAssignments.git (push) ➜ devinline-git-recap git:(master) ✗ git remote remove upstr ➜ devinline-git-recap git:(master) ✗ git remote -v origin https://github.com/zytham/Udacity_DeepLearningAssignments.git (fetch) origin https://github.com/zytham/Udacity_DeepLearningAssignments.git (push)
Reference: https://help.github.com/articles/configuring-a-remote-for-a-fork/
0 comments:
Post a Comment