Planting willow branches was practiced among Ancient Chinese to commemorate Shen Nong, the originator of farming who taught people how to do farm work. In some places, people put wickers under eaves to forecast weather. If the wicker is fresh and green, it will rain; dry wicker, sunny days. Huang Chao Uprising ruled that the date of uprising scheduled on Qingming and wearing wicker was a secret signal. When the uprising was defeated, the custom of wearing wicker vanished gradually but willow planting kept prevailing. Willow boasts great vitality. As the proverb goes, painstaking efforts to grow flowers may turn in vain, but unintentionally planted wicker will grow into a big tree. This means that willow branches are easy to survive and thrive.
Another saying also explains the reason for planting willow branches during Qingming. Originally, China had three ghost festivals that fell on Qingming, the 15th day of the 7th lunar month and the first day of 10th lunar month. During these times, ghosts would haunt for something. To prevent ghosts from harassing the living, people planted and wore willow branches. As a mass, willow was able to exorcise evil spirits. Influenced by Buddhism, people thought that the willow could repel ghosts so they called it Guibumu (a kind of wood that ghosts afraid of). The Goodness of Mercy saved people from agony and sufferings by dipping the willow twig into water. Jia Sixie, from the Northern Wei Dynasty, mentioned in his “Important Arts for the People’s Walfare” that suspending willow twigs at your door could keep ghosts away. Qingming was a ghost festival and, at this time of the year, the willow began to sprout. Thus, people planted and wore willow twigs to counteract evil forces.
Another version is that this custom was to commemorate Jie Zitui. Jie was burnt to death under a giant willow tree because he set his mind to preserve his reputation and integrity. Duke Wen of Jin and his subjects were all grieved over his death. The next year, Duke Wen led them to worship Jie and, to his surprise, the willow revived. Duke Wen immediately named the old willow tree as Qingming Willow. He also nipped a wicker and wore on his head to express his remembrance to Jie. Since then, his subjects also followed him and this practice gradually became popular.
Source: Confucius Institute Online