Domanda

Hello I recently started using github. I was able to make my first commit and upload my Java projects whole source folder to my only Repo. Now I have made changes to my files and would like to recommit the same files but after two hours of tutorials I am still stuck.

This is the process I have been doing.

Windows 8
Gitbash
 cd ~\javaProjectSourceFolder(lets call it java)
 git init
  initializes
 git add -A
 git status
  nothing to commit, working directory clean

I realize I am a newb and that I am not able to "add" my files. Can somebody help me out?

È stato utile?

Soluzione

Please make sure you are on the right branch. If not then do the following from the terminal on the repository path. You should do your changes to a local branch, that may be the clone of the master. And next time follow these steps.

git branch :This will list all your branch. You must see master branch over there.

git checkout master : This will make you to switch on the master branch.

git checkout -b local_branch : This will create a branch with local_branch name & then you can add all your code here.

git add -A : this will automatically add the files that are even newly created or modified or deleted.

git commit -m "my commit message : This way you can do a commit to all changes.

git pull origin HEAD : This will update the current branch with any changes (in case of shared repository) You can avoid this as you are the only one working on your only repo.

git push origin HEAD : This will push your changes to the remote branch, but it will not merge this to the master unless you either push it to master or try merging from web on git hub.

For more information on each & every command, please refer the treasure here

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top