How to return to master branch


the commands are not working as i am still in sarah branch , i need to return to master but when i run git checkout master , its showing not a git repository

You need to be inside the directory of the repository. Since you’re in the /home/sarah directory, git has no idea what you’re talking about.

For more than this, I’ll need a link to the lab you’re using, which you should always give us when you’re asking a question about a lab.

Thank you sir for letting me know , i didnt know the process earlier

this is the link of the lab problem

Hi @Kathakali-Saha,

When attempting to run the command, it reports that the .git directory is missing or that the current directory is not recognized as a Git repository. As a result, the command is unable to locate the necessary files.

I suggest you run the “ls -l” command also to see the files/directories in the current directory.

1 Like

For that lab, we take a look at what’s in /home/sarah, and we can see where the repo is:

sarah $ ls -la
total 28
drwxr-sr-x    1 sarah    sarah         4096 Apr 16 20:17 .
drwxr-xr-x    1 root     root          4096 Nov  9  2021 ..
-rw-r--r--    1 sarah    sarah          202 Nov  9  2021 .bashrc
-rw-r--r--    1 sarah    sarah           48 Apr 16 20:17 .gitconfig
-rw-r--r--    1 sarah    sarah           41 Apr 16 20:17 .token
-rw-r--r--    1 sarah    sarah           50 Nov  9  2021 .vimrc
drwxr-sr-x    3 sarah    sarah         4096 Apr 16 20:17 story-blog
sarah $ ls -la story-blog/
total 20
drwxr-sr-x    3 sarah    sarah         4096 Apr 16 20:17 .
drwxr-sr-x    1 sarah    sarah         4096 Apr 16 20:17 ..
drwxr-sr-x    8 sarah    sarah         4096 Apr 16 20:17 .git
-rw-r--r--    1 sarah    sarah          792 Apr 16 20:17 frogs-and-ox.txt
-rw-r--r--    1 sarah    sarah         1086 Apr 16 20:17 lion-and-mouse.txt
sarah $ 

So you can see, story-blog/ has the .git directory, and is a repository. The /home/sarah directory is not.

1 Like