GENERALLY IMPORTANT:
2. Version Control (Git)
Concept: Tracking changes in the source code over time, which allows for collaboration and rollback if needed.
Basic Tools: Git, GitHub, GitLab.
Key Terms: Commit, Branch, Merge, Pull Request.
create a python file in git
\>>touch main.py
Set-up
Configuring user information used across all local repositories.
**>>**git config --global user.name “[firstname lastname]”
set a name that is identifiable for credit when review version history
**>>**git config --global user.email “[valid-email]”
set an email address that will be associated with each history marker
**>>**git config --global color.ui auto
set automatic command line coloring for Git for easy reviewing
init commands
Configuring user information, initializing and cloning repositories
**>>**git init
initialize an existing directory as a Git repository
**>>**git clone [url]
retrieve an entire repository from a hosted location via URL
in Working Directory
**>>**git status
shows the status
untracted files - working directories(files that are open in some other platform)
**>>**git add file_name
Normal add of files
in Staging Area
\>>git commit
\>>git commit -m "msg"
\>>git status
show modified files in working directory, staged for your next commit
\>>git add [file]
add a file as it looks now to your next commit (stage)
\>>git reset [file]
unstage a file while retaining the changes in working directory
\>>git diff
diff of what is changed but not staged
\>>git diff --staged
diff of what is staged but not yet commited
\>>git commit -m “[descriptive message]”
commit your staged content as a new commit snapshot
from Local to remote repo
\>>git push -u origin main
if failed
To check >> git branch
master
\>>git push -u origin master
success
Branches
Divisions of Repo
create a branch >>git checkout -b "Name" //here checkout mean jumping between the branches
main/master - types of repo
branches -------> Pull Request --------> Merge(@owner)
Push commits
- For deploying every File must be in 'master'
Fork
To copy repo to our code space.
Issues
To contribute or to fix the errors issues faced
You can chat & know actual issue
Fork clone to local machine
change fix
add, commit, raise PR
branch has no conflicts/ Merge Conflicts
\>>git fetch
Just copy the changes from master
\>>git pull
Just completely adopt changes
\>>git merge origin/master