-
Notifications
You must be signed in to change notification settings - Fork 0
git exemplo4
pedrofelix edited this page Mar 2, 2015
·
1 revision
-
Considere-se a existência do repositório presente em
C:\work\LocalRepoName
. -
O comando
clone
cria um nova repositório com a cópia do repositórioLocalRepoName
C:\work>git clone c:/work/LocalRepoName LocalRepoClone
Cloning into LocalRepoClone...
done.
C:\work>dir
Volume in drive C has no label.
Volume Serial Number is 0817-EBAE
Directory of C:\work
21-09-2011 12:46 <DIR> .
21-09-2011 12:46 <DIR> ..
21-09-2011 12:46 <DIR> LocalRepoClone
21-09-2011 12:40 <DIR> LocalRepoName
0 File(s) 0 bytes
4 Dir(s) 27.184.992.256 bytes free
C:\work>dir LocalRepoClone
Volume in drive C has no label.
Volume Serial Number is 0817-EBAE
Directory of C:\work\LocalRepoClone
21-09-2011 12:46 <DIR> .
21-09-2011 12:46 <DIR> ..
21-09-2011 12:46 <DIR> .git
21-09-2011 12:46 24 file1.txt
21-09-2011 12:46 8 file2.txt
2 File(s) 32 bytes
3 Dir(s) 27.184.992.256 bytes free
C:\work>cd LocalRepoClone
C:\work\LocalRepoClone>git log
commit 48cc123aa3f2fcd3e7a67edc6833c0ccc759ad69
Author: Pedro Felix <[email protected]>
Date: Wed Sep 21 12:40:56 2011 +0100
adicionei file2.txt
commit f741c4de062741c4cbe54e25c7c03da8690db6bb
Author: Pedro Felix <[email protected]>
Date: Wed Sep 21 11:39:55 2011 +0100
mensagem do segundo commit
commit b3a159dc18c86dd81854524988f7d4f73505c3f5
Author: Pedro Felix <[email protected]>
Date: Wed Sep 21 11:22:05 2011 +0100
Texto descritivo do commit
- Note-se que foi criado um novo repositório (
LocalRepoName
) e que a árvore de trabalho contém o conteúdo do último commit. Note-se também que o historial do repositório original está presente no novo repositório.
- Caso o repositório original seja alterado, é possível obter as alterações através do comando
pull
.
C:\work\LocalRepoClone>cd ..
C:\work>cd LocalRepoName
C:\work\LocalRepoName>echo line1 >> file-created-after-clone.txt
C:\work\LocalRepoName>git add file-created-after-clone.txt
C:\work\LocalRepoName>git commit -m "added file after clone"
[master 1ca48d5] added file after clone
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 file-created-after-clone.txt
C:\work\LocalRepoName>cd ..\LocalRepoClone
C:\work\LocalRepoClone>dir
Volume in drive C has no label.
Volume Serial Number is 0817-EBAE
Directory of C:\work\LocalRepoClone
21-09-2011 12:46 <DIR> .
21-09-2011 12:46 <DIR> ..
21-09-2011 12:46 <DIR> .git
21-09-2011 12:46 24 file1.txt
21-09-2011 12:46 8 file2.txt
2 File(s) 32 bytes
3 Dir(s) 27.184.439.296 bytes free
C:\work\LocalRepoClone>git pull origin master
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 2 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (2/2), done.
From c:/work/LocalRepoName
* branch master -> FETCH_HEAD
Updating 48cc123..1ca48d5
Fast-forward
file-created-after-clone.txt | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 file-created-after-clone.txt
C:\work\LocalRepoClone>dir
Volume in drive C has no label.
Volume Serial Number is 0817-EBAE
Directory of C:\work\LocalRepoClone
21-09-2011 12:51 <DIR> .
21-09-2011 12:51 <DIR> ..
21-09-2011 12:51 <DIR> .git
21-09-2011 12:51 8 file-created-after-clone.txt
21-09-2011 12:46 24 file1.txt
21-09-2011 12:46 8 file2.txt
3 File(s) 40 bytes
3 Dir(s) 27.184.369.664 bytes free