Monday, 15 September 2014

merge - merging code outside of git into an existing git project -



merge - merging code outside of git into an existing git project -

i have existing git project, let's phone call bobcrane. needed re-work project's extensive directory structure.

i created needed directory construction on filesystem, outside of git project. manually copied each file cloned bobcrane repo new directory structure. new directories filled old files; there 1 or 2 new ones didn't exist before.

how can add/commit/push new construction existing git repo? related "rebasing"?

init git repository @ new directory structure git init commit files git add together -a git commit -m "commit message" add existing repository remote git remote add together origin your_existing_repository@url

merge approach

pull changes remote git pull origin remote_branch_name after resolving conflicts execute git add together -a git merge --continue

rebase approach

fetch changes remote git fetch

5.1. rebase onto remote branch

git rebase origin/remote_branch_name

5.2. resolve conflicts if , execute

git add together -a git rebase --continue

6. force new commits existing repository

git force -u origin remote_branch_name

rebase preferred way because produce cleaner commits history

git merge rebase

No comments:

Post a Comment