GittaskAbrar
GittaskAbrar
Task1:
1. Log in to the Linux server, create a directory, and create a filename index.txt (enter hello worked
text inside file)inside the directory.
Mkdir abrargittask
cd abrargittask
2. Install Git on the Linux server, then check the Git version.
git --version
3. Initialize a Git repository in the created directory, add the changes to the staging area, and
commit the changes.
git init
1. Create a branch and switch to it, then edit the `index.txt` file to add "hello git".
git branch
4. Switch from one branch to another without using the `git switch` command.
Task3:
1. Create two branches, one named `feature` and the other named `test`, each containing the file
`index.txt` with different content. Merge these two branches, but keep only the changes from
the `test` branch.
2. Combine the changes from the two branches without using the `git merge` command.
Task4:
1. Connect a remote repository to your local repository on a Linux server, then create a file in the
remote repository.
2. Fetch the changes from the remote repository to your local repository without committing the
changes to the current branch.
3. Fetch the changes from the remote repository to your local repository and commit the changes
to the current branch.
4. Display the list of branches in the remote repository using a Linux command.
git branch -r
git log -5
Task:5
2. Rename a branch.
1. Create three branches (`dev`, `test`, `prod`) each containing the file `index.txt`.
2. Switch to the `test` branch, create a file `test.txt`, add and commit the changes.
3. Copy the specific changes from the `test` branch (`test.txt`) into the `dev` and `prod` branches
without merging branches.
4. Finally, check the commit history in each branch to ensure the changes were successful.
Task:7
1. Create two branches (dev and test) with the file index.txt.
3. In the test branch, add and commit the changes, then switch back to the dev branch to add and
commit the already staged changes.
git add
Task:8
git pull
It can be done using git settings , go to developer settings by adding personal access token generation
Task:9
1. I want to undo the changes currently in the commit history and working directory.
2. I want to undo the changes from the previous commit without altering the commit history.
3. Create a directory, initialize a Git repository, then create a file named `index.txt` and commit the
changes.
Mkdir abrar
cd abrar
git init
4. Create another file named `feature.txt`, add it, and commit the changes.
git reflog
Task:10
git remote -v
3. How to view the remote repository with branches in the local setup.
git branch -r