Skip to content

Instantly share code, notes, and snippets.

@dileeph
Created January 2, 2016 05:10
Show Gist options
  • Save dileeph/786f097276a451e6142a to your computer and use it in GitHub Desktop.
Save dileeph/786f097276a451e6142a to your computer and use it in GitHub Desktop.
Github commit steps
Committing project to own repository for first time
//Configure username, email
git config --global user.name "userx"
git config --global user.email "[email protected]"
//Go to the folder where code is to be committed first time into repo (assuming repo //exists and no code present)
git init
//First thing will be to add the test-service project folder with all subfolders and //files into local repository.
git add test-service
git commit -m 'first commit'
//Now code is committed to the local master branch.
//Link this to the remote master – we will call it ‘origin’
git remote add origin https://github.com/dileeph/spring-boot.git
git remote –v
//Now PUSH code from local master to remote master (origin)
git push origin master
//If there is already files existing in remote repo this will fail – in case of github //you always create a readme.md file. This creates conflict between local master and //remote master
//So next step we will resolve that by “rebasing” our local repo to match “origin”
git pull --rebase origin master
//Remote code is pulled and moves the local branch pointer to the “head” of the //origin.
//Now we can commit code from here to origin
git push origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment