DevNet Associate DEVASC 200-901 Official Certification Guide by Adrian Iliesiu (z-lib.org)

(andrew) #1
coding-101-python
git init (directory name)

To create a completely new repository, you need to create
a directory. Luckily, git init can be supplied with a
directory name as an option to do this all in one
command:


Click here to view code image


#git init newrepo
Initialized empty Git repository in
/Users/chrijack/Documents/
GitHub/newrepo/.git/
#newrepo git:(master)

What you just created is an empty repository, and you
need to add some files to it. By using the touch
command, you can create an empty file. The following
example shows how to view the new file in the repository
with the directory (ls) command:


Click here to view code image


#newrepo git:(master) touch newfile
#newrepo git:(master) ls
newfile

Once the file is added, Git sees that there is something
new, but it doesn’t do anything with it at this point. If
you type git status, you can see that Git identified the
new file, but you have to issue another command to add
it to index for Git to perform version control on it. Here’s
an example:


Click here to view code image


# git status
On branch master
Free download pdf