How to return to "master" using git?

I made my first commit; then create a branch (let say branch1).

In this thread, I created the directory "example" and earned. On GitHub, I see a new branch and a new “example” that I added.

Now I wonder how I can “synchronize” with the wizard; and therefore the "example" folder has been deleted (since it does not exist on the server).

EDIT: find . -type d -empty -exec touch {}/.gitignore \; find . -type d -empty -exec touch {}/.gitignore \; performed this work.

+89
git
Sep 14 '11 at 13:32
source share
4 answers

You need to check the branch:

 git checkout master 

See the Git cheat sheets for more details.

Edit: Note that git does not manage empty directories, so you will have to manage them yourself. If your directory is empty, simply delete it directly.

+159
Sep 14 2018-11-11T00:
source share

According to the Git Cheatsheet, you need to create a branch first

 git branch [branchName] 

and then

 git checkout [branchName] 
+3
Jun 21 '16 at 17:38
source share

I am trying to understand what is going on there. Is there anything in your "sample" folder? Git does not track empty folders.

If you forked and switched to a new branch, then created a new folder and left it empty, and then executed "git commit -a", you would not get this new folder in commit.

This means that it is not being tracked, which means that checking another branch will not delete it.

+1
Sep 14 2018-11-11T00:
source share

To delete a branch, you must save the changes made in the branch, or you need to commit the changes made in the branch. Follow these steps if you made any changes to the current branch.

  1. git stash or git commit -m "XXX"
  2. git checkout master
  3. git branch -D merchantApi

Note. The above steps remove the branch locally.

0
May 24 '19 at 7:16
source share



All Articles