0% encontró este documento útil (0 votos)
21 vistas7 páginas

Guía de configuración y uso de Git

El documento explica los pasos para configurar y utilizar Git para control de versiones de un proyecto. En resumen: 1) Se configura el nombre de usuario y correo electrónico global de Git. 2) Se clona un repositorio de Bitbucket para trabajar en un proyecto. 3) Se crea y cambia a una rama de desarrollo para realizar modificaciones sin afectar la rama principal. 4) Se realizan cambios en archivos, se confirman los cambios y se suben al repositorio remoto.
Derechos de autor
© All Rights Reserved
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como DOCX, PDF, TXT o lee en línea desde Scribd
0% encontró este documento útil (0 votos)
21 vistas7 páginas

Guía de configuración y uso de Git

El documento explica los pasos para configurar y utilizar Git para control de versiones de un proyecto. En resumen: 1) Se configura el nombre de usuario y correo electrónico global de Git. 2) Se clona un repositorio de Bitbucket para trabajar en un proyecto. 3) Se crea y cambia a una rama de desarrollo para realizar modificaciones sin afectar la rama principal. 4) Se realizan cambios en archivos, se confirman los cambios y se suben al repositorio remoto.
Derechos de autor
© All Rights Reserved
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como DOCX, PDF, TXT o lee en línea desde Scribd

GIT

Configuracin global de la cuenta de git.


git config --global [Link] "fgupioc"
git config --global [Link] dsgeg.9026@[Link]

Mostrar la configuracion global de git.


git config list

Para comenzar con el proyecto DATANET debemos clonar el proyecto del


repositorio en la carpeta

C:\laragon\www en el caso de Laragon. Para ello entramos a travs de la


consola CMD en Windows.

C:\xampp\htdocs en el caso de xampp .

y escribimos o pegamos la direccin del repositorio ejem.

git clone [Link]

Va a descargar una carpeta con el nombre datanet y entramos a la carpeta


con cd

cd datanet

Y por defecto estar con la rama master OJO NO TRABAJAR EN ESA RAMA.

Para trabajar crearemos otra rama con el nombre devel con el siguiente
cdigo

git checkout b devel

Luego de eso vamos a pasar los archivos de master a devel con el comando
git merge devel
ya estando en la rama trabajaran en ella y tambin subirn sus cambios de
acuerdo a como vayan avanzando.

Para que vean que archivos van modificando en el proyecto usen el siguiente
comando.
git status

Para el ejemplo modifique dos archivos las rutas y una vista. como se ve en la
imagen

>> modified: resources/views/[Link]


>> modified: routes/[Link]

Eso son los archivos modificados saldrn de color rojo y tambin la rama
aparecer de color Rojo.

Para subir esos archivos modificados al repositorio van hacer los siguiente
git add all
luego para ver que efectiva mente se a agregado a la cola de guardado
escribimos el siguiente cdigo(esto es opcional)
git status

Y vemos que los archivos que estaban de rojo ahora estn de color verde. Lo
siguiente es ponerle un comentario con el siguiente comando(obligatorio)
git commit m modificar la vista welcome y la rura welcome
Vemos que la rama devel de color rojo paso a blanco eso quiere decir que
esta listo para
subir al repositorio. Y si ponen de nuevo el comando
git status

Ya no habra archivos para hacer comentarios

=>MUY IMPORTANTE
Antes de subir los archivos al repositorio vamos a escribir el siguiente
codigo
git pull origin devel

este comando es para bajar del repositorio cambios que otro de nosostro
aya subido antes obiamnete les pedira susus ccredenciales, es muy
importante hacer eso xk si no malogramos la rama. En el caso de que nos
muestre un mensaje de conflicto esto singifica que mas de uno a modificado
el mismo archivo

NO ENCONTRE NINGUNA IMAGEN PERO TENGAN CUIDDO CON LOS


CONFLICTOS

Si ental caso alla bajado cambio tendran que hacer de nuevo los siguientes
comandos
git add all
git status (opcional)
git commit m comentario adecuado
git status (opcioal)

ya estamos listos para subirlo al repositorio con el siguiente codigo


git push origin devel
les va a pedir sus credenciales

Ponen su contrasenia y despues se subira


Y ya tendran sus cambios en el repositorio disponible para el tro usuario

C:\laragon\www\appTest (devel)

C:\laragon\www\appTest (devel)
cd..

C:\laragon\www
git config --global [Link] "jemseduardo"

C:\laragon\www
ls
appTest/ ecommerce/ [Link] socialite/

C:\laragon\www
git config --list
[Link]=false
[Link]=true
[Link]=auto
[Link]=auto
[Link]=auto
[Link]=true
[Link]=html
[Link]=C:/Program Files/Git/mingw64/ssl/certs/[Link]
[Link]=astextplain
[Link]=true
[Link]=false
[Link]=true
[Link]=auto
[Link]=auto
[Link]=auto
[Link]=true
[Link]=2g
[Link]=html
[Link]=/ssl/certs/[Link]
[Link]=astextplain
[Link]=true
[Link]=jemseduardo

C:\laragon\www
git config --global [Link] [Link]@[Link]

C:\laragon\www
git clone
[Link]
Cloning into 'testdatanet12'...
Password for '[Link]
remote: Invalid username or password. If you log in via a third party service
you must ensure you have an account password set in your account profile.
fatal: Authentication failed for
'[Link]

C:\laragon\www
git clone
[Link]
Cloning into 'testdatanet12'...
Password for '[Link]
remote: Counting objects: 122, done.
remote: Compressing objects: 100% (94/94), done.
remote: Total 122 (delta 12), reused 108 (delta 9)
Receiving objects: 100% (122/122), 216.12 KiB | 0 bytes/s, done.
Resolving deltas: 100% (12/12), done.

C:\laragon\www
ls
appTest/ ecommerce/ [Link] socialite/ testdatanet12/

C:\laragon\www
cd testdatanet12\

C:\laragon\www\testdatanet12 (master)
git checkout devel
Branch devel set up to track remote branch devel from origin.
Switched to a new branch 'devel'

C:\laragon\www\testdatanet12 (devel)
git status
On branch devel
Your branch is up-to-date with 'origin/devel'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified: resources/views/[Link]

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

C:\laragon\www\testdatanet12 (devel)
git add --all

C:\laragon\www\testdatanet12 (devel)
git status
On branch devel
Your branch is up-to-date with 'origin/devel'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)

modified: resources/views/[Link]

C:\laragon\www\testdatanet12 (devel)
git commit -m "modificar la vista welcome ejmplo"
[devel 244b818] modificar la vista welcome ejmplo
1 file changed, 3 insertions(+)

C:\laragon\www\testdatanet12 (devel)
git status
On branch devel
Your branch is ahead of 'origin/devel' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean

C:\laragon\www\testdatanet12 (devel)
git pull origin devel
Password for '[Link]
From [Link]
* branch devel -> FETCH_HEAD
Already up-to-date.

C:\laragon\www\testdatanet12 (devel)
git push origin devel
Password for '[Link]
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 433 bytes | 0 bytes/s, done.
Total 5 (delta 3), reused 0 (delta 0)
remote:
remote: Create pull request for devel:
remote: [Link]
requests/new?source=devel&t=1
remote:
To [Link]
5d5322d..244b818 devel -> devel

C:\laragon\www\testdatanet12 (devel)
git estatus
git: 'estatus' is not a git command. See 'git --help'.

Did you mean this?


status

C:\laragon\www\testdatanet12 (devel)
git status
On branch devel
Your branch is up-to-date with 'origin/devel'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified: resources/views/[Link]

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

C:\laragon\www\testdatanet12 (devel)
git checkout -f
Your branch is up-to-date with 'origin/devel'.

C:\laragon\www\testdatanet12 (devel)
gis status
"gis" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.

C:\laragon\www\testdatanet12 (devel)

Common questions

Con tecnología de IA

Errors during repository cloning typically arise from authentication failures, incorrect URLs, or network issues. To mitigate these, ensure the repository URL is correct and accessible, and verify that your credentials (username and password) or SSH keys are correctly configured. Additionally, ensure a stable internet connection and verify any network restrictions that might hinder communication with the server .

Merging branches in Git involves integrating changes from one branch into another, typically the main branch, to incorporate individual contributions into the project's primary workflow. Handling merge conflicts is vital because simultaneous modifications to the same parts of a project can lead to inconsistencies or data loss if not resolved properly. This requires developers to carefully review conflicting changes, decide on the best approach for integration, and ensure that the final merged state reflects the intended functionality without introducing bugs .

Authentication issues when pushing changes to a Bitbucket repository typically occur due to incorrect credentials or lack of proper account settings. This can be addressed by ensuring that the correct username and password are used. If third-party services are used for login, ensure your account has an associated password set in your profile settings. This might involve updating stored credentials or using a personal access token or SSH keys for secure authentication, which reduces password dependency .

The execution of 'git add --all' stages all changes in the working directory, including modifications, deletions, and new files, making them ready to be committed to the repository's history. This is a comprehensive approach to ensure that no changed files are omitted before the commit phase, providing a streamlined process for capturing a snapshot of the current project state .

To clone a Git repository and start working on a new branch, follow these steps: First, use the command `git clone` followed by the repository URL to clone the project into your local machine. This will create a folder with the repository's name. Navigate into this folder using `cd <folder_name>`. By default, you will be on the 'master' branch. Create a new branch by executing `git checkout -b <branch_name>`, such as 'devel'. After creating the branch, you can work on it and make changes without disturbing the 'master' branch .

After encountering a conflict during a `git pull`, the following sequence helps resolve and commit changes: First, identify the conflicted files using `git status`. Manually resolve conflicts by editing these files to the desired state. Once resolved, add the files back to the staging area with `git add <file>`. To conclude, create a new commit with `git commit -m"resolved conflict description"`, effectively documenting the resolution process in the commit message .

Running 'git pull' before pushing changes to a repository is crucial to ensure that your local branch is updated with the latest changes from the remote repository. This command fetches and merges any changes other contributors have made to the same branch, preventing conflicts. If not executed, there's a risk of overwriting other collaborators' modifications if they have been made on the same files, leading to potential merge conflicts that can be complex to resolve .

Using branches in Git for a collaborative project is critical for efficient workflow management and isolation of features or fixes. Each branch allows team members to work independently, minimizing disruptions and conflicts with others' work. Without branches, contributors risk modifying the same files in the 'master' branch simultaneously, leading to significant merge conflicts and the potential for accidentally overwriting crucial code, which compromises project stability and progress .

To check which files have been modified in a Git repository before committing, use the `git status` command. This command lists all modified files that have not yet been staged for commit. Modified files appear in red, indicating that changes have been made but are not yet in the staging area. This allows users to review and verify changes before proceeding to add them with `git add` .

After modifying files in a Git repository, follow these steps to prepare and execute a commit: first, check the status of your repository using `git status` to see which files have been changed. Stage the changes by running `git add --all`, which prepares the modified files to be committed. Optionally, verify the staged files with `git status` again, ensuring they appear in green, indicating readiness for commit. Finally, commit the changes with a clear message using `git commit -m "message"`, which records the changes in the repository's history .

También podría gustarte