[Git] Change case of a folder name
Make sure you have the ignorecase
set to false:
git config core.ignorecase false
Then, do two git mv
:
git mv foldername tempname
git mv tempname folderName
Make sure you have the ignorecase
set to false:
git config core.ignorecase false
Then, do two git mv
:
git mv foldername tempname
git mv tempname folderName
Use git rebase
to select commits you want to modify
git rebase -i --root
And then for each rebase step, execute the following:
git commit --amend --reset-author --no-edit
git rebase --continue
docker run -it --rm alpine /bin/ash
First, get the internal IP of the target container:
docker container inspect $MY_CONTAINER
Then you can access the desire port by its IP
x.x.x.x:$TARGET_PORT
git clone --recurse-submodules remote_url
git submodule add submodule_remote_url local_linking_path
# Then commit & push to the main repo
# Pull from specific branch
git pull --recurse-submodules my-branch
# Then commit & push to the main repo
cd submodule_path
# Do the commits and push normally, the changes will be pushed to submodule repo
cd main
# Then do a commit and push to the main module
git submodule update --init
kubectl config view
kubectl cluster-info
# Example output
Kubernetes control plane is running at https://10.0.0.9:8443
KubeDNS is running at https://10.0.0.9:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
kubectl get xxx -o wide -A
kubectl describe xxx
# Use -l $LABEL to filter using labels
# USe --show-labels to show labels
# xxx can be nodes, pods, deployments,
# events, services, replicaset, etc.
# To specify a specific object: xxx/name. For example: deloy/my-deploy
# For full list and the short names, do
kubectl api-resources
# Create
kubectl create -f config.yaml
# Edit. Can be used to rollout a new version when editing deployments
kubectl edit xxx/$NAME
# Delete
kubectl delete xxx/$NAME
kubectl delete -f config.yaml
kubectl create deployment hello-node --image=k8s.gcr.io/echoserver:1.4
# 8080 here is the container port
# NodePort exposes the ports on each node running related pods
kubectl expose deployment/hello-node --type="NodePort" --port 8080
kubectl scale deployments/kubernetes-bootcamp --replicas=4
kubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=jocatalin/kubernetes-bootcamp:v2 --record=true
# Check the rollout status
kubectl rollout status deployments/kubernetes-bootcamp
# Undo the rollout
# This rollback to previous replicaset
kubectl rollout undo deployments/kubernetes-bootcamp
# Find the replicaset you want to restore
# (default 10 history replicasets are saved)
kubectl get rs -o wide
kubectl rollout history $DEPLOY
# Get the revision number of the desired replicaset
kubectl describe rs kubernetes-bootcamp-fb5c67579
# Rollback to the specific replicaset
kubectl rollout undo deployments/kubernetes-bootcamp --to-revision=2
kubectl logs $POD_NAME
kubectl exec $POD_NAME -- $COMMAND
# Start a bash session. If no container specified, kubectl.kubernetes.io/default-container will be used
kubectl exec -it $POD_NAME -c $CONTAINER_NAME -- bash
# Method 1. Port-forwarding
kubectl port-forward POD_NAME HOST_PORT:POD_PORT
# Then you can access the endpoint at
# localhost:HOST_PORT
# Method 2. Proxy
kubectl proxy
# Then you can access the endpoint at
# http://localhost:8001/api/v1/namespaces/default/pods/$POD_NAME:$POD_PORT/proxy/
# Attach a new label
kubectl label pods $POD_NAME version=v1
# View labels of a Pod
kubectl describe pods $POD_NAME
# Create a secret
kubectl create secret generic $SECRET [--from-file file_name] [--from-literal]
# Show a secret
kubectl get secret/xxx -o json
kubectl create configmap $CONFIGMAP [--from-file] [--from-literal]
# Drain a Node to move all Pods to other Nodes
kubectl drain $NODE
# Undo draining
kubectl uncordon $NODE to revert
kubectl delete service hello-node
kubectl delete deployment hello-node
minikube stop
minikube delete
docker-compose.yml
localhost:port
, this is like running up docker-compose inside a “pod machine”, but the container network is configured as hostIf you have master merged into your current branch, your git log
will be messy because it also shows the commits from the master.
If you want to show your branch logs, use the following command:
git log master..
or
git log master..mybranch
* git log a..b
actually means “includes commits that are (backward) reachable from b but exclude those that are reachable from a”
Assume you have conflicts after executing git stash pop
:
git reset
to mark conflicts as resolvedgit stash drop
because git doesn’t do it if conflicts occurAssume we have following branches:
We want to cut commit_3 and commit_4 on branch_2, onto master (commit_2). We can use the commands:
git checkout branch_2
git rebase --onto b111dc9 34e3359
(git rebase --onto new_base old_base)
The result looks like this:
If we want the commits but not to modify the incoming branch (branch_2 in the above example), we can use cherry-pick
:
git checkout master
git cherry-pick 34e3359..321b7c0
(git cherry-pick start_commit_not_included..end_commit_included)