Commit and push to a newly created repository:
Navigate to folder with git cmd
Add the files in your new local repository. This stages them for the first commit.
Commit the files that you’ve staged in your local repository.
At the top of your GitHub repository’s Quick Setup page, click to copy the remote repository URL. In the Command prompt, add the URL for the remote repository where your local repository will be pushed.
Push the changes in your local repository to GitHub.
Conflict with commit to origin master?, do a pull before commit.
git config --global credential.helper wincred git init git add . git commit -m "first commit" git remote add origin remote_repos_url git push origin master git pull origin master
Cloning a repository:
Navigate to where you want to store the repository:
cp the url and run:
git clone https://github.com/spawnmarvel/powershell-cmd.git
Do some code changes, here we added a new file:
Then run the below code and the repository is updated
git add . git commit -m "from new pc" git push origin master
Change repository and work more there:
cd.. cd t-sql git add . git commit -m "change dir" git push origin master
Branch, if the branch “test” was created and we did some some changes
git branch git add . git commit - m "my commit" git push origin HEAD:test
git checkout master git merge --no-f test git push origin master or git push origin test
Pull (will pull changes from the origin remote, master branch and merge them to the local checked-out branch)
git pull origin master