0% found this document useful (0 votes)
13 views7 pages

Comandos Git y Manejo de Archivos

The document shows the logs of a user working with Git. They are trying to add, commit and push changes to a local Git repository but are running into issues like files not being found, authentication errors when pushing, and unknown commands. They create a new file called ejercicio100.txt but then remove it from staging. In the end, they check the status again and it still shows the file as untracked.

Uploaded by

NinaBurgos
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views7 pages

Comandos Git y Manejo de Archivos

The document shows the logs of a user working with Git. They are trying to add, commit and push changes to a local Git repository but are running into issues like files not being found, authentication errors when pushing, and unknown commands. They create a new file called ejercicio100.txt but then remove it from staging. In the end, they check the status again and it still shows the file as untracked.

Uploaded by

NinaBurgos
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

FamiliaBenitezBurgos@FBenitezBurgos MINGW32 ~/Desktop/semana03-actividad01-VHBH

(main)
$ cd ejercicio
bash: cd: ejercicio: No such file or directory

FamiliaBenitezBurgos@FBenitezBurgos MINGW32 ~/Desktop/semana03-actividad01-VHBH


(main)
$ ejercicio2
bash: ejercicio2: command not found

FamiliaBenitezBurgos@FBenitezBurgos MINGW32 ~/Desktop/semana03-actividad01-VHBH


(main)
$ cd ejercicio2

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git add [Link]
fatal: pathspec '[Link]' did not match any files

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git status
On branch main
Your branch and 'origin/main' have diverged,
and have 1 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)

Untracked files:
(use "git add <file>..." to include in what will be committed)
../[Link]
./
../[Link]

nothing added to commit but untracked files present (use "git add" to track)

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git status
On branch main
Your branch and 'origin/main' have diverged,
and have 1 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)

Untracked files:
(use "git add <file>..." to include in what will be committed)
../[Link]
./
../[Link]

nothing added to commit but untracked files present (use "git add" to track)

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git log
commit 811850fdd145de90aac1d0f7b37b7df063905920 (HEAD -> main)
Author: Victor Benitez <victor.benitez0@[Link]>
Date: Thu Aug 5 22:09:50 2021 -0500

e agregahore: add [Link]

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git log --stat
commit 811850fdd145de90aac1d0f7b37b7df063905920 (HEAD -> main)
Author: Victor Benitez <victor.benitez0@[Link]>
Date: Thu Aug 5 22:09:50 2021 -0500

e agregahore: add [Link]

[Link] | 0
1 file changed, 0 insertions(+), 0 deletions(-)
FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git status
On branch main
Your branch and 'origin/main' have diverged,
and have 1 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)

Untracked files:
(use "git add <file>..." to include in what will be committed)
../[Link]
./
../[Link]

nothing added to commit but untracked files present (use "git add" to track)

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git add .

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git status
On branch main
Your branch and 'origin/main' have diverged,
and have 1 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)

Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: [Link]

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git commit -m "chore:se agrego"
[main 9bddbbf] chore:se agrego
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 ejercicio2/[Link]

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git commit --amend
[main fbc2561] chore:se agrego
Date: Fri Aug 6 18:49:01 2021 -0500
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 ejercicio2/[Link]

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git log
commit fbc2561bb945bd28d49bd6e20d29c896b089a761 (HEAD -> main)
Author: Victor Benitez <victor.benitez0@[Link]>
Date: Fri Aug 6 18:49:01 2021 -0500

chore:se agrego

commit 811850fdd145de90aac1d0f7b37b7df063905920
Author: Victor Benitez <victor.benitez0@[Link]>
Date: Thu Aug 5 22:09:50 2021 -0500

e agregahore: add [Link]

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git commit --amend
[main 17f57c0] chore:se agrego nuevamente
Date: Fri Aug 6 18:49:01 2021 -0500
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 ejercicio2/[Link]
FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git log
commit 17f57c0e1f025b3dc254dd96ab7bd2b072bfa095 (HEAD -> main)
Author: Victor Benitez <victor.benitez0@[Link]>
Date: Fri Aug 6 18:49:01 2021 -0500

chore:se agrego nuevamente

commit 811850fdd145de90aac1d0f7b37b7df063905920
Author: Victor Benitez <victor.benitez0@[Link]>
Date: Thu Aug 5 22:09:50 2021 -0500

e agregahore: add [Link]

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git push origin main
remote: Invalid username or password.
fatal: Authentication failed for '[Link]
[Link]/'

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ cd ejercicio2
bash: cd: ejercicio2: No such file or directory

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ touch [Link]

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git status
On branch main
Your branch and 'origin/main' have diverged,
and have 2 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)

Untracked files:
(use "git add <file>..." to include in what will be committed)
[Link]

nothing added to commit but untracked files present (use "git add" to track)

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git add .

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git status
On branch main
Your branch and 'origin/main' have diverged,
and have 2 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)

Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: [Link]

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git restore --staged [Link]

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git status
On branch main
Your branch and 'origin/main' have diverged,
and have 2 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)

Untracked files:
(use "git add <file>..." to include in what will be committed)
[Link]

nothing added to commit but untracked files present (use "git add" to track)

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git status
On branch main
Your branch and 'origin/main' have diverged,
and have 2 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)

Untracked files:
(use "git add <file>..." to include in what will be committed)
[Link]

nothing added to commit but untracked files present (use "git add" to track)

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git checkout --[Link]
error: unknown option `[Link]'
usage: git checkout [<options>] <branch>
or: git checkout [<options>] [<branch>] -- <file>...

-b <branch> create and checkout a new branch


-B <branch> create/reset and checkout a branch
-l create reflog for new branch
--guess second guess 'git checkout <no-such-branch>' (default)
--overlay use overlay mode (default)
-q, --quiet suppress progress reporting
--recurse-submodules[=<checkout>]
control recursive updating of submodules
--progress force progress reporting
-m, --merge perform a 3-way merge with the new branch
--conflict <style> conflict style (merge or diff3)
-d, --detach detach HEAD at named commit
-t, --track set upstream info for new branch
-f, --force force checkout (throw away local modifications)
--orphan <new-branch>
new unparented branch
--overwrite-ignore update ignored files (default)
--ignore-other-worktrees
do not check if another worktree is holding the given
ref
-2, --ours checkout our version for unmerged files
-3, --theirs checkout their version for unmerged files
-p, --patch select hunks interactively
--ignore-skip-worktree-bits
do not limit pathspecs to sparse entries only
--pathspec-from-file <file>
read pathspec from file
--pathspec-file-nul with --pathspec-from-file, pathspec elements are
separated with NUL character

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git status
On branch main
Your branch and 'origin/main' have diverged,
and have 2 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)

Untracked files:
(use "git add <file>..." to include in what will be committed)
[Link]
nothing added to commit but untracked files present (use "git add" to track)

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git add .

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git status
On branch main
Your branch and 'origin/main' have diverged,
and have 2 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)

Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: [Link]

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git restore --staged [Link]
FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$ git status
On branch main
Your branch and 'origin/main' have diverged,
and have 2 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)

Untracked files:
(use "git add <file>..." to include in what will be committed)
[Link]

nothing added to commit but untracked files present (use "git add" to track)

FamiliaBenitezBurgos@FBenitezBurgos MINGW32
~/Desktop/semana03-actividad01-VHBH/ejercicio2 (main)
$

Se crea repositorio git init

Se crea archivo dentro del repositorio git touch (nombre de archivo)

Se envia el archivo al area intermedia git add (nombre del archivo)

Se realiza cambio con git commit –amend.

Se commitea git commit –m “chore: add nombre del archivo “

Se envia a repositorio con git push irigin main


GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)

 cloning into [Link]

remote: Enumerating objects: 3, done.

remote: Counting objects: 100% (3/3), done.

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

From [Link]

* [new branch] main -> origin/main

HEAD branch: main

Switched to a new branch 'main'

Branch 'main' set up to track remote branch 'main' from 'origin'.

Common questions

Powered by AI

File extensions and naming conventions play crucial roles in organizing files and managing the repository by providing clear identification of file types and purposes. In the context given, the use of extensions like '.txt.txt' indicates potential redundancy or error in naming, which could lead to confusion or duplication. Proper conventions aid in effective file tracking and retrieval, especially when dealing with multiple files within a project .

The 'git status' command is crucial for providing information about the current state of the working directory and staging area in Git. According to the document, it informs the user about the current branch divergence, untracked files in the directory, and changes ready to be committed. This helps the user understand what is included for the next commit and any actions needed to sync with the remote repository .

The use of Git commands demonstrated version control best practices through routine checks via 'git status' to understand the repository's state, staging changes with 'git add', making commits with clear messages, and amending commits to refine history. These practices enhance transparency, keep project state organized, and communicate changes effectively, aligning with the principles of traceability and accountability .

The sequence of actions to stage and commit a new file in Git as observed includes first using 'git add .' to stage the new file 'ejercicio02.txt.txt' for commit. Then, a commit was made with a message using 'git commit -m "chore:se agrego"' to include the change in the project history, which involved creating the file in the repository without any insertions or deletions .

The 'git commit --amend' command is used to modify the most recent commit. In the document, it was significant in updating the commit message to "chore:se agrego nuevamente,” allowing for correction and improvement of commit history by editing the last commit without creating a new one. This approach is beneficial for maintaining a cleaner, concise commit history by enabling modifications to the last action before it’s pushed to the remote repository .

The challenges involved in synchronizing branches included the divergence of the local branch from the remote with distinct commits in each. This typically requires a 'git pull' to merge changes from the remote branch into the local branch. Generally, such challenges can be addressed by frequently fetching and merging remote changes, using rebase for cleaner history, and resolving merge conflicts that may arise during synchronization .

The 'git pull' command in Git version control is used to fetch the latest changes from the remote repository and merge them into the current branch in the local repository. It is relevant to the scenario described, as the local branch had diverged from the remote 'main' branch, with each having different commits. This caused a need for 'git pull' to sync the local branch with the remote branch by fetching the remote changes and integrating them locally .

Untracked files can be problematic in Git workflows because they indicate files that have not been added to the commit history, potentially leading to inconsistencies between the working directory and the repository. In the described activities, untracked files like 'ejercicio100.txt' were mentioned which could cause confusion or incomplete project states if not properly added or ignored as needed. Managing untracked files through steps like 'git add' or '.gitignore' helps ensure coherence between local and remote versions .

Command misinterpretation impacted the troubleshooting process when the user attempted to use 'cd ejercicio' and 'ejercicio2' in incorrect contexts, resulting in an error message about non-existent directories. Similarly, an error occurred when attempting to use 'git checkout --ejercicio100.txt', which was misunderstood as an option. This reflects common pitfalls in command-line usage, necessitating careful checking of command syntax .

The document does not provide explicit resolution to the authentication issue encountered during the 'git push' operation. Instead, it highlights the obstacle with a remote authentication failure due to invalid credentials. This indicates a need to review the username and password or setup SSH keys to resolve such issues in Git operations .

You might also like