AEC Git and GitHub Commands
AEC Git and GitHub Commands
i) Create a new folder called “aec” and switch into the folder
mkdir aec
cd aec
i) Create a new folder called “aec” and switch into the folder
mkdir aec
cd aec
b) Fetch the latest changes from a remote repository and rebase your
local branch onto the updated remote branch.
git fetch
git checkout -b feature-branch
git rebase origin/master
touch hello.txt
git add .
git commit -m “adds hello file”
git checkout master
git rebase feature-branch
4) Git Tags and Releases Write the command to create a lightweight Git
tag named "v1.0" for a commit in your local repository
i) Create a new folder called “aec” and switch into the folder
mkdir aec
cd aec
(To see the tag run git log, v1.0 will be present there)
5) Advanced Git Operations Write the command to cherry-pick a range
of commits from "source-branch" to the current branch
i) Create a new folder called “aec” and switch into the folder
mkdir aec
cd aec
Here the commit hash is the full word from 5fe8….c354 (copy the entire
thing it will be different in your commit)
i) Create a new folder called “aec” and switch into the folder
mkdir aec
cd aec
a) Given a commit ID, how would you use Git to view the details of that
specific commit, including the author, date, and commit message?
git show commit-hash
b) Write the command to list all commits made by the author "JohnDoe"
between "2023-01-01" and "2023-12-31."
git log --author="JohnDoe" --since="2023-01-01" --until="2023-12-31"
c) Write the command to display the last five commits in the repository's
history.
git log -n 5
d) Write the command to undo the changes introduced by the commit
with the ID "abc123"
git revert commit-hash