Using Git Pull and Push with Shallow Clones | Generated by AI

Home 2025.06

Yes, you can still use git pull or git push after cloning a repository with a limited history using --depth=20. However, there are some important considerations to keep in mind:

1. What --depth=20 Does

2. Using git pull with a Shallow Clone

3. Using git push with a Shallow Clone

4. Limitations of Shallow Clones

5. How to Deepen a Shallow Clone (If Needed)

If you encounter issues with git pull or git push due to limited history, you can fetch additional history:

6. Practical Advice

Example Workflow

# Clone with limited history
git clone git@github.com:cisco/ChezScheme.git --depth=20
cd ChezScheme

# Make changes and commit
git commit -m "My changes"

# Pull latest changes
git pull origin main

# Push your changes
git push origin main

If you run into issues due to the shallow clone, deepen the history as described above.

Summary

Yes, you can use git pull and git push with a shallow clone created using --depth=20. However, you may need to fetch additional history for certain operations if the shallow history is insufficient. Use git fetch --deepen or git fetch --unshallow to address any limitations.


Back Donate