Reputation: 16639
I need to commit my changes (new files) to the existing master branch. However, end up creating a new branch
I have a directory structure on git as
master -> Projects -> Proj1 -> folder1
I do a
git clone
git branch master
git checkout master
I add new folders to Proj 1.
Local git structure becomes
master -> Projects -> Proj1 -> folder1 -> folder2 -> file1
-> file2
Now i do a
git add
git commit -m ""
When i do a git push origin Projects
, it creates a new branch Projects
master -> Projects -> Proj1 -> folder1 -> folder2 -> file1
-> file2
Projects -> Proj1 -> folder1 -> folder2 -> file1
-> file2
How can i prevent creating a new branch?
will git push origin master
do the trick?
Upvotes: 0
Views: 60
Reputation: 411252
You should do git push origin master
, or just git push
. In general, git push
takes the form git push <remote> <branch>
.
Upvotes: 0
Reputation: 661
If you want push your changes into branch master you must do
git push origin master
Because name after origin is the name of your branch you want to push. So if you doing git push origin Projects You are pushing to branch "Projects" If You want add new file to project You must do
git add filename
git commit -am "new filename"
git push origin master
Upvotes: 1