GIT Commands - dennisholee/notes GitHub Wiki
- Initialize an existing project:
git init
- Register new remote repository:
git remote add origin {GIT URL}
- Fetch and update local repo:
git pull origin master
- Missing tracking information warning
git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> master
Specify the remote repository and branch i.e. 'origin' and 'master' git pull origin master
https://stackoverflow.com/questions/32056324/there-is-no-tracking-information-for-the-current-branch
- Add new files
git add .
- Commit
git commit -m '{message}
- Push to remote repo
git push origin master
- Clone repo
git clone {remote Git repo URL}
$ git push origin master
To https://github.com/{username}/{repo_name}.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/{username}/{repo_name}.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
- Pull changes
git pull origin master
where 'origin' it the remote server tag and 'master' it the branch - Checkout the conflicting file from remote server
git checkout --theirs {path_to_file}
- Add changes
git add {path_to_file}
- Commit changes
git commit -m 'Resolve conflict'
- Push changes
git push origin master