<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sujitha</title>
    <description>The latest articles on DEV Community by Sujitha (@sujitha_de18764cdb03a6652).</description>
    <link>https://dev.to/sujitha_de18764cdb03a6652</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3080417%2F4bb1ecde-980f-4aaa-badd-d1ce325b43f0.png</url>
      <title>DEV Community: Sujitha</title>
      <link>https://dev.to/sujitha_de18764cdb03a6652</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sujitha_de18764cdb03a6652"/>
    <language>en</language>
    <item>
      <title>Creating a Docker Image and Pushing to DockerHub for a Python ML App</title>
      <dc:creator>Sujitha</dc:creator>
      <pubDate>Fri, 25 Apr 2025 18:51:53 +0000</pubDate>
      <link>https://dev.to/sujitha_de18764cdb03a6652/creating-a-docker-image-and-pushing-to-dockerhub-for-a-python-ml-app-2n96</link>
      <guid>https://dev.to/sujitha_de18764cdb03a6652/creating-a-docker-image-and-pushing-to-dockerhub-for-a-python-ml-app-2n96</guid>
      <description>&lt;p&gt;In this post, I’ll walk through how I built a simple machine learning app using Python, packaged it into a Docker image, and then pushed that image to DockerHub. This setup makes it easy to run the app on any machine, without worrying about installing dependencies or setting up the environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;The Machine Learning App&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The app trains a logistic regression model on the Iris dataset to classify flowers based on sepal and petal measurements. It loads the data, prints basic info, generates and saves visualizations, splits the dataset, trains the model, evaluates accuracy, and saves the trained model using Joblib.&lt;/p&gt;

&lt;p&gt;Make sure to place the &lt;code&gt;Iris.csv&lt;/code&gt; file in the same directory as &lt;code&gt;app.py&lt;/code&gt; so that the script can access it during execution.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here's the Python file used:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from pandas import read_csv
from matplotlib import pyplot
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
import joblib

# Step 1: Load dataset
filename = "Iris.csv"
data = read_csv(filename)

# Step 2: Display data shape and preview
print("Shape of the dataset:", data.shape)
print("First 20 rows:\n", data.head(20))

# Step 3: Plot and save histograms silently
data.hist()
pyplot.savefig("histograms.png")
pyplot.close()  # Close the plot so it doesn't show up in prompt

# Step 4: Plot and save density plots silently
data.plot(kind='density', subplots=True, layout=(3,3), sharex=False)
pyplot.savefig("density_plots.png")
pyplot.close()

# Step 5: Convert to NumPy array and extract features/labels
array = data.values
X = array[:, 1:5]  # Features: Sepal/Petal measurements
Y = array[:, 5]    # Target: Species

# Step 6: Split data into training (67%) and testing (33%)
test_size = 0.33
seed = 7
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=test_size, random_state=seed)

# Step 7: Create and train logistic regression model
model = LogisticRegression(max_iter=200)
model.fit(X_train, Y_train)

# Step 8: Evaluate and display accuracy
result = model.score(X_test, Y_test)
print("Accuracy: {:.2f}%".format(result * 100))

# Step 9: Save the trained model to a file
joblib.dump(model, "logistic_model.pkl")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa04xaqda82rytddivinv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa04xaqda82rytddivinv.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Writing the Dockerfile&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Once the app was working locally, the next step was to containerize it using Docker. For this, I created a simple &lt;code&gt;Dockerfile&lt;/code&gt; that starts from a lightweight Python base image, installs the required dependencies, copies the code into the image, and defines the command to run the script when the container starts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here's the Dockerfile used:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM python:3.9-slim

RUN pip install pandas scikit-learn matplotlib joblib

COPY . .

CMD ["python", "app.py"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This setup ensures that anyone who runs this image will get the same environment and behavior, no matter where they are.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Building the Docker Image&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Once the Dockerfile was ready, I opened PowerShell, navigated to the project directory, and ran the following command:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faetzbqh3buin3uv4f221.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faetzbqh3buin3uv4f221.png" alt="Image description" width="800" height="255"&gt;&lt;/a&gt;Docker pulled the base image, installed the libraries, copied the code, and built the final image. The build process completed successfully, creating a local image tagged as &lt;code&gt;sujisuki/24mcr111-ml:latest.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fprgjva3wsh6lj0zgebfv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fprgjva3wsh6lj0zgebfv.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;strong&gt;Pushing the Docker Image to DockerHub&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;With the image built locally, the next step was to make it available online by pushing it to DockerHub.&lt;/p&gt;

&lt;p&gt;First, I logged into DockerHub from the terminal:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsf9cc3qdd5pqb0jpdqg9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsf9cc3qdd5pqb0jpdqg9.png" alt="Image description" width="800" height="124"&gt;&lt;/a&gt;After authentication, I pushed the image to my repository:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft4tf6b25i4afb9kbfqd5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft4tf6b25i4afb9kbfqd5.png" alt="Image description" width="800" height="120"&gt;&lt;/a&gt;Docker uploaded the image layers to the remote repository, and the image became publicly available at&lt;br&gt;
&lt;a href="https://hub.docker.com/r/sujisuki/24mcr111-ml" rel="noopener noreferrer"&gt;https://hub.docker.com/r/sujisuki/24mcr111-ml&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fylr1g2c2e526u783og8r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fylr1g2c2e526u783og8r.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now anyone can pull and run this image on their system using a single command.&lt;/p&gt;

</description>
      <category>coding</category>
      <category>docker</category>
      <category>python</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Creating a Docker Image and Pushing to DockerHub for a Python ML App</title>
      <dc:creator>Sujitha</dc:creator>
      <pubDate>Fri, 25 Apr 2025 18:51:53 +0000</pubDate>
      <link>https://dev.to/sujitha_de18764cdb03a6652/creating-a-docker-image-and-pushing-to-dockerhub-for-a-python-ml-app-57gl</link>
      <guid>https://dev.to/sujitha_de18764cdb03a6652/creating-a-docker-image-and-pushing-to-dockerhub-for-a-python-ml-app-57gl</guid>
      <description>&lt;p&gt;In this post, I’ll walk through how I built a simple machine learning app using Python, packaged it into a Docker image, and then pushed that image to DockerHub. This setup makes it easy to run the app on any machine, without worrying about installing dependencies or setting up the environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;The Machine Learning App&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The app trains a logistic regression model on the Iris dataset to classify flowers based on sepal and petal measurements. It loads the data, prints basic info, generates and saves visualizations, splits the dataset, trains the model, evaluates accuracy, and saves the trained model using Joblib.&lt;/p&gt;

&lt;p&gt;Make sure to place the &lt;code&gt;Iris.csv&lt;/code&gt; file in the same directory as &lt;code&gt;app.py&lt;/code&gt; so that the script can access it during execution.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here's the Python file used:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from pandas import read_csv
from matplotlib import pyplot
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
import joblib

# Step 1: Load dataset
filename = "Iris.csv"
data = read_csv(filename)

# Step 2: Display data shape and preview
print("Shape of the dataset:", data.shape)
print("First 20 rows:\n", data.head(20))

# Step 3: Plot and save histograms silently
data.hist()
pyplot.savefig("histograms.png")
pyplot.close()  # Close the plot so it doesn't show up in prompt

# Step 4: Plot and save density plots silently
data.plot(kind='density', subplots=True, layout=(3,3), sharex=False)
pyplot.savefig("density_plots.png")
pyplot.close()

# Step 5: Convert to NumPy array and extract features/labels
array = data.values
X = array[:, 1:5]  # Features: Sepal/Petal measurements
Y = array[:, 5]    # Target: Species

# Step 6: Split data into training (67%) and testing (33%)
test_size = 0.33
seed = 7
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=test_size, random_state=seed)

# Step 7: Create and train logistic regression model
model = LogisticRegression(max_iter=200)
model.fit(X_train, Y_train)

# Step 8: Evaluate and display accuracy
result = model.score(X_test, Y_test)
print("Accuracy: {:.2f}%".format(result * 100))

# Step 9: Save the trained model to a file
joblib.dump(model, "logistic_model.pkl")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa04xaqda82rytddivinv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa04xaqda82rytddivinv.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Writing the Dockerfile&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Once the app was working locally, the next step was to containerize it using Docker. For this, I created a simple &lt;code&gt;Dockerfile&lt;/code&gt; that starts from a lightweight Python base image, installs the required dependencies, copies the code into the image, and defines the command to run the script when the container starts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here's the Dockerfile used:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM python:3.9-slim

RUN pip install pandas scikit-learn matplotlib joblib

COPY . .

CMD ["python", "app.py"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This setup ensures that anyone who runs this image will get the same environment and behavior, no matter where they are.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Building the Docker Image&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Once the Dockerfile was ready, I opened PowerShell, navigated to the project directory, and ran the following command:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faetzbqh3buin3uv4f221.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faetzbqh3buin3uv4f221.png" alt="Image description" width="800" height="255"&gt;&lt;/a&gt;Docker pulled the base image, installed the libraries, copied the code, and built the final image. The build process completed successfully, creating a local image tagged as &lt;code&gt;sujisuki/24mcr111-ml:latest.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fprgjva3wsh6lj0zgebfv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fprgjva3wsh6lj0zgebfv.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;strong&gt;Pushing the Docker Image to DockerHub&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;With the image built locally, the next step was to make it available online by pushing it to DockerHub.&lt;/p&gt;

&lt;p&gt;First, I logged into DockerHub from the terminal:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsf9cc3qdd5pqb0jpdqg9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsf9cc3qdd5pqb0jpdqg9.png" alt="Image description" width="800" height="124"&gt;&lt;/a&gt;After authentication, I pushed the image to my repository:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft4tf6b25i4afb9kbfqd5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft4tf6b25i4afb9kbfqd5.png" alt="Image description" width="800" height="120"&gt;&lt;/a&gt;Docker uploaded the image layers to the remote repository, and the image became publicly available at&lt;br&gt;
&lt;a href="https://hub.docker.com/r/sujisuki/24mcr111-ml" rel="noopener noreferrer"&gt;https://hub.docker.com/r/sujisuki/24mcr111-ml&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fylr1g2c2e526u783og8r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fylr1g2c2e526u783og8r.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now anyone can pull and run this image on their system using a single command.&lt;/p&gt;

</description>
      <category>coding</category>
      <category>docker</category>
      <category>python</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Advanced Git Commands</title>
      <dc:creator>Sujitha</dc:creator>
      <pubDate>Fri, 25 Apr 2025 18:05:23 +0000</pubDate>
      <link>https://dev.to/sujitha_de18764cdb03a6652/advanced-git-commands-578b</link>
      <guid>https://dev.to/sujitha_de18764cdb03a6652/advanced-git-commands-578b</guid>
      <description>&lt;p&gt;&lt;strong&gt;1. &lt;code&gt;git diff&lt;/code&gt;: See What’s Changed&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git diff&lt;/code&gt; shows you the difference between various states of your code. This can be between your working directory and the staging area, or between commits.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdg5hs3qjw5rosylxt5q2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdg5hs3qjw5rosylxt5q2.png" alt="Image description" width="800" height="186"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. &lt;code&gt;git log&lt;/code&gt;: Explore Your Project History&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git log&lt;/code&gt; helps you see a list of all the commits that have been made in a repository.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F217i8qgjgcl3yvc6rzqi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F217i8qgjgcl3yvc6rzqi.png" alt="Image description" width="800" height="376"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. &lt;code&gt;git clone&lt;/code&gt;: Copy an Existing Repository&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git clone&lt;/code&gt; lets you make a full copy of a Git repository from a remote source (like GitHub) to your local machine.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/username/repository.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a directory with the entire project history and working files.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. &lt;code&gt;git pull&lt;/code&gt;: Bring Changes from Remote to Local&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git pull&lt;/code&gt; fetches the changes from the remote repository and merges them into your local branch.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git pull origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This fetches and merges the changes from the main branch on the remote.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. &lt;code&gt;git blame&lt;/code&gt;: Track Who Changed What&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git blame&lt;/code&gt; shows who last modified each line of a file and when.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftrs9ogorfu2h1goxgug2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftrs9ogorfu2h1goxgug2.png" alt="Image description" width="800" height="442"&gt;&lt;/a&gt;&lt;strong&gt;6. Git Merge Conflicts: When Things Don't Auto-Merge&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Merge conflicts happen when Git can’t automatically resolve differences between branches. This usually happens when two people edit the same line in a file or delete a file that someone else modified.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. &lt;code&gt;git branch&lt;/code&gt;: Manage Code Versions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;git branch lets you create, list, rename, and delete branches. Branching is key to isolating work, like developing new features or fixing bugs, without affecting the main codebase.&lt;/p&gt;

&lt;p&gt;Common usage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git branch — lists all branches.
git branch new-feature — creates a new branch.
git checkout new-feature — switches to that branch.
git checkout -b new-feature — creates and switches in one command.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5td9d02c7iwf3di7ctdd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5td9d02c7iwf3di7ctdd.png" alt="Image description" width="800" height="271"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. &lt;code&gt;.gitignore&lt;/code&gt;: Tell Git What to Skip&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;.gitignore&lt;/code&gt; file tells Git which files or directories to ignore in a project.&lt;/p&gt;

&lt;p&gt;Use cases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ignoring sensitive files like .env.&lt;/li&gt;
&lt;li&gt;Skipping OS-generated files like .DS_Store or Thumbs.db.&lt;/li&gt;
&lt;li&gt;Excluding build artifacts or dependencies like node_modules/.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node_modules/
.env
*.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;9. GitHub Wiki: Documentation Made Easy&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Every GitHub repository can have its own Wiki — a place to host documentation, guides, project notes, or anything related to the repo.&lt;/p&gt;

&lt;p&gt;Why it’s helpful:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keeps project documentation organized and accessible.&lt;/li&gt;
&lt;li&gt;Great for onboarding new contributors.&lt;/li&gt;
&lt;li&gt;Easy to edit via the GitHub UI or clone and update like a regular Git repo.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To use it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the “Wiki” tab in your GitHub repository.&lt;/li&gt;
&lt;li&gt;Click “Create the first page” to start documenting.&lt;/li&gt;
&lt;li&gt;You can even clone the Wiki using git clone 
&lt;code&gt;https://github.com/username/repository.wiki.git.&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Git is much more than just &lt;code&gt;add&lt;/code&gt;, &lt;code&gt;commit&lt;/code&gt;, and &lt;code&gt;push&lt;/code&gt;. Understanding commands like &lt;code&gt;git diff&lt;/code&gt;, &lt;code&gt;git blame&lt;/code&gt;, or how to resolve &lt;code&gt;merge conflicts&lt;/code&gt; will give you more control and confidence in your version control workflow. Combine that with good practices like using &lt;code&gt;.gitignore&lt;/code&gt; and documenting your projects with &lt;code&gt;GitHub Wiki&lt;/code&gt;, and you'll be collaborating like a pro in no time.&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>learning</category>
      <category>coding</category>
    </item>
    <item>
      <title>Working With Git Commands</title>
      <dc:creator>Sujitha</dc:creator>
      <pubDate>Wed, 23 Apr 2025 17:58:36 +0000</pubDate>
      <link>https://dev.to/sujitha_de18764cdb03a6652/working-with-git-commands-2h26</link>
      <guid>https://dev.to/sujitha_de18764cdb03a6652/working-with-git-commands-2h26</guid>
      <description>&lt;p&gt;&lt;strong&gt;1. Initialize Your Git Repository&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First things first, we need to turn your project folder into a Git repository. Open your terminal and run this command:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6lshhfhkuctb4utl3ua1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6lshhfhkuctb4utl3ua1.png" alt="Image description" width="800" height="58"&gt;&lt;/a&gt;This creates a .git folder in your project, which allows Git to start tracking changes in your files.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Add Files to the Staging Area&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Next, we need to tell Git which files we want to track. Use the following command to add all your changes:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fddz5ovkv5xippk8nmnpl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fddz5ovkv5xippk8nmnpl.png" alt="Image description" width="800" height="72"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Commit Your Changes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once your files are staged, it’s time to commit them to your local repository. A commit is like a snapshot of your project at a certain point. You can do this with:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft8ptpfdrapxtvv7hrvle.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft8ptpfdrapxtvv7hrvle.png" alt="Image description" width="800" height="132"&gt;&lt;/a&gt;Be sure to write a message that clearly describes what changes you're committing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Configure Git (Username and Email)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Git needs to know who you are so it can associate commits with your identity. Set your name and email with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; git config --global user.name "Your Name"
&amp;gt; git config --global user.email "your.email@example.com"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5. Add a Remote Repository&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you want to push your local project to a remote server, you'll need to link your local Git repository to a remote one. To do this, use:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;git remote add origin &lt;code&gt;&amp;lt;repository-url&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Replace &lt;code&gt;&amp;lt;repository-url&amp;gt;&lt;/code&gt; with the URL of your remote repository, like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1w596cvjm06nmy18fhyk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1w596cvjm06nmy18fhyk.png" alt="Image description" width="800" height="60"&gt;&lt;/a&gt;&lt;strong&gt;6. Check the Status of Your Files&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To see what's going on with your files—whether they’re staged, modified, or untracked—use:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvg1v59cegfon8q8g2buc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvg1v59cegfon8q8g2buc.png" alt="Image description" width="657" height="137"&gt;&lt;/a&gt;&lt;strong&gt;7. Work with Branches&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Git allows you to work on different parts of your project without affecting the main codebase. To see what branches you have, run:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg2sn17n49vwccg1rgrpl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg2sn17n49vwccg1rgrpl.png" alt="Image description" width="792" height="237"&gt;&lt;/a&gt;&lt;strong&gt;8. Push Your Changes to a Remote Repository&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now that you've committed your changes, it's time to push them to a remote repository like GitHub. To do this, run:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgsv1yvhavoinftw8og1z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgsv1yvhavoinftw8og1z.png" alt="Image description" width="800" height="241"&gt;&lt;/a&gt;This sends your local changes to the remote repository on the main branch. If you’re using another branch, just replace main with the branch name.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9. View Your Commit History&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you want to see a list of all the commits you’ve made so far, use:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2y5oz382r3yzec8ztu5e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2y5oz382r3yzec8ztu5e.png" alt="Image description" width="800" height="163"&gt;&lt;/a&gt;This will show you all the commits in reverse chronological order, with details like the commit ID, author, and message.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10. File Successfully Pushed to Git Repository&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once you've run all the above steps, your files are now successfully pushed to your Git repository. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw69sayku77glhhoblrzh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw69sayku77glhhoblrzh.png" alt="Image description" width="800" height="397"&gt;&lt;/a&gt;You can go to your repository's URL and see the code, commits, and branches reflected online.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk9cmbjdtc01vpb9dru8k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk9cmbjdtc01vpb9dru8k.png" alt="Image description" width="800" height="399"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that’s it! These are the core Git commands you’ll use to manage your code, track changes, and collaborate with others.&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>learning</category>
      <category>coding</category>
    </item>
  </channel>
</rss>
