Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- **PROBLEM:** Upload your source content to the remote origin for the first time.
- **SOLUTION:** First create an empty repository to the remote origin. Then locally you should run the following git commands.
- ```
- $ cd 'go to your application path'
- $ git init
- $ git remote add origin 'put remote repository url'
- $ git add .
- $ git commit -m "write a comment"
- $ git push origin master
- ```
- **PROBLEM:** How to merge branch with master?
- **SOLUTION:**
- ```
- $ git checkout master
- $ git merge 'your development branch'
- $ git push origin master
- $ git checkout 'your development branch'
- ```
- **PROBLEM:** Your branch and 'origin/master' have diverged.
- **SOLUTION:** Run `git pull` to merge the remote branch into yours. As a result of that, if you have unmerged paths then you should fix conflicts first and then run `git commit -m "give a message here"`. Otherwise run `git merge --abort` to abort the merge.
- **PROBLEM:** `$ git push origin master` shows the following error as follows:
- Updates were rejected because the remote contains work that you do
- not have locally. This is usually caused by another repository pushing
- to the same ref. You may want to first merge the remote changes (e.g.,
- `git pull`) before pushing again. See the 'Note about fast-forwards' in `git push --help` for details.
- **SOLUTION:** `$ git pull` or `$ git push -f origin master`
- BEWARE: Using `force` can change the history for other contributors on the same project. Basically, if you do not care about a file being deleted for everyone, just go ahead. Especially if you are the only contributor on the project.
- However, `$ git pull` may generate the following issue:
- >"please enter a commit message to explain why this merge is necessary, especially if it merges an updated upstream into a topic branch."
- We can get rid of this issue by executing the following steps:
- 1. press `i`
- 2. write your `merge` message
- 3. press `esc`
- 4. write `:wq`
- 5. then press `enter`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement