0% found this document useful (0 votes)
8 views

Version Contrl Example

Uploaded by

George Mathew
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Version Contrl Example

Uploaded by

George Mathew
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git

$ ls -lta

total 8

drwxr-xr-x 1 sf2k 197121 0 Feb 16 08:05 ./

drwxr-xr-x 1 sf2k 197121 0 Feb 16 08:05 a-project/

drwxr-xr-x 1 sf2k 197121 0 Feb 16 08:05 b-project/

drwxr-xr-x 1 sf2k 197121 0 Feb 16 08:05 c-project/

drwxr-xr-x 1 sf2k 197121 0 Feb 16 08:03 ../

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git

$ cd a-project

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project

$ git init

Initialized empty Git repository in C:/Users/sf2k/Downloads/git/a-project/.git/

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ git add --all .

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ git commit -m "first version"

Author identity unknown

* Please tell me who you are.


Run

git config --global user.email "[email protected]"

git config --global user.name "Your Name"

to set your account's default identity.

Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'sf2k@DESKTOP-


KDSNI90.(none)')

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ git config --global user.email "[email protected]"

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ git config --global user.name "Sam"

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ git commit -m "first version"

[master (root-commit) b1be932] first version

1 file changed, 1 insertion(+)

create mode 100644 a.txt

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ git log

commit b1be93223c10a20a9600449ad00b90ba62b6c3cf (HEAD -> master)

Author: Sam <[email protected]>

Date: Thu Feb 16 08:09:44 2023 -0500


first version

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ git status

On branch master

Changes not staged for commit:

(use "git add <file>..." to update what will be committed)

(use "git restore <file>..." to discard changes in working directory)

modified: a.txt

no changes added to commit (use "git add" and/or "git commit -a")

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ git add --all .

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ git commit -m

error: switch `m' requires a value

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ git commit -m "second version"

[master 80c1155] second version

1 file changed, 1 insertion(+), 1 deletion(-)


sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ git logs

git: 'logs' is not a git command. See 'git --help'.

The most similar command is

log

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ git log

commit 80c1155ad4b73076c698a4bece1076ce00a721f2 (HEAD -> master)

Author: Sam <[email protected]>

Date: Thu Feb 16 08:11:19 2023 -0500

second version

commit b1be93223c10a20a9600449ad00b90ba62b6c3cf

Author: Sam <[email protected]>

Date: Thu Feb 16 08:09:44 2023 -0500

first version
sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ cat a.txt

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ git checkout b1be93

Note: switching to 'b1be93'.

You are in 'detached HEAD' state. You can look around, make experimental

changes and commit them, and you can discard any commits you make in this

state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may

do so (now or later) by using -c with the switch command. Example:

git switch -c <new-branch-name>

Or undo this operation with:

git switch -

Turn off this advice by setting config variable advice.detachedHead to false


HEAD is now at b1be932 first version

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project ((b1be932...))

$ cat a.txt

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project ((b1be932...))

$ git checkout master

Previous HEAD position was b1be932 first version

Switched to branch 'master'

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ cat a.txt

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ vi a.txt

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ git checkout master

Already on 'master'

M a.txt
sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ git commit -m "third version; I changed it to 5 because it was a bad day"

On branch master

Changes not staged for commit:

(use "git add <file>..." to update what will be committed)

(use "git restore <file>..." to discard changes in working directory)

modified: a.txt

no changes added to commit (use "git add" and/or "git commit -a")

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ git add --all .

warning: in the working copy of 'a.txt', LF will be replaced by CRLF the next
time Git touches it

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ rm a.txt

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ git checkout a.txt


Updated 1 path from the index

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ cat a.txt

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ git add --all .

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ git commit -m "third version; I changed it to 5 because it was a bad day"

[master 9601381] third version; I changed it to 5 because it was a bad day

1 file changed, 1 insertion(+), 1 deletion(-)

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/a-project (master)

$ cd ..

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git

$ git clone https://github.com/samred/Demos.git

Cloning into 'Demos'...

remote: Enumerating objects: 38, done.


remote: Total 38 (delta 0), reused 0 (delta 0), pack-reused 38

Receiving objects: 100% (38/38), 26.99 KiB | 2.45 MiB/s, done.

Resolving deltas: 100% (9/9), done.

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git

$ cd Demos/

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/Demos (master)

$ ls -lta

total 26

drwxr-xr-x 1 sf2k 197121 0 Feb 16 08:18 .git/

drwxr-xr-x 1 sf2k 197121 0 Feb 16 08:18 dependency-assembler/

drwxr-xr-x 1 sf2k 197121 0 Feb 16 08:18 ./

-rw-r--r-- 1 sf2k 197121 9 Feb 16 08:18 README.md

-rw-r--r-- 1 sf2k 197121 11560 Feb 16 08:18 LICENSE

-rw-r--r-- 1 sf2k 197121 201 Feb 16 08:18 .gitignore

drwxr-xr-x 1 sf2k 197121 0 Feb 16 08:18 ../

sf2k@DESKTOP-KDSNI90 MINGW64 ~/Downloads/git/Demos (master)

You might also like