I normally start a new project by creating a repo on Github and then take a clone on local machine. After that i bootstrap my project using some tool like create-react-app, react-native cli or express-generator.
React-native cli throws an error if there is a directory already present. So for react-native projects, i need to create project on my local first then i need to set upstream to Github repo.
git branch
is not returning anything immediately after git init
Normally default branch of newly created repository is master
. so i tried to execute git branch
after initialising Git repository using git init
but no result came up. I found that as soon as you add files in repository then only it start showing the branch name 'master'.
Push local changes to Github repo
- set upstream with Github repo
git remote add origin <Github repo url>
- push changes to remote repository forcefully.
git push -f origin master
Without -f param, it rejects the push operation because remote Git is not in sync with local machine. So it ask you to pull changes from remote and merge with local repository before making push operation.
Hope it helps.
Top comments (0)